Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion blockproducer/metastate.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,8 @@ func (s *metaState) updateBilling(tx *types.UpdateBilling) (err error) {
err = errors.Wrap(ErrDatabaseNotFound, "update billing failed")
return
}
if tx.Range.From >= tx.Range.To || newProfile.LastUpdatedHeight != tx.Range.From {

if tx.Version > 0 && (tx.Range.From >= tx.Range.To || newProfile.LastUpdatedHeight != tx.Range.From) {
err = errors.Wrapf(ErrInvalidRange,
"update billing within range %d:(%d, %d]",
newProfile.LastUpdatedHeight, tx.Range.From, tx.Range.To)
Expand Down
4 changes: 4 additions & 0 deletions blockproducer/metastate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,7 @@ func TestMetaState(t *testing.T) {
To: 10,
},
})
ub.Version = int32(ub.HSPDefaultVersion())
nonce, err = ms.nextNonce(addr2)
So(err, ShouldBeNil)
ub.Nonce = nonce
Expand Down Expand Up @@ -1352,6 +1353,7 @@ func TestMetaState(t *testing.T) {
},
},
}
ub1.Version = int32(ub1.HSPDefaultVersion())
err = ub1.Sign(privKey1)
So(err, ShouldBeNil)
err = ms.apply(ub1)
Expand Down Expand Up @@ -1442,6 +1444,7 @@ func TestMetaState(t *testing.T) {
},
},
}
ub2.Version = int32(ub2.HSPDefaultVersion())
err = ub2.Sign(privKey2)
So(err, ShouldBeNil)
err = ms.apply(ub2)
Expand Down Expand Up @@ -1493,6 +1496,7 @@ func TestMetaState(t *testing.T) {
},
},
}
ub3.Version = int32(ub3.HSPDefaultVersion())
err = ub3.Sign(privKey2)
So(err, ShouldBeNil)
err = ms.apply(ub3)
Expand Down
4 changes: 2 additions & 2 deletions cmd/cql-minerd/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ func benchDB(b *testing.B, db *sql.DB, createDB bool) {
})

routineCount := runtime.NumGoroutine()
if routineCount > 100 {
if routineCount > 150 {
b.Errorf("go routine count: %d", routineCount)
} else {
log.Infof("go routine count: %d", routineCount)
Expand Down Expand Up @@ -777,7 +777,7 @@ func benchDB(b *testing.B, db *sql.DB, createDB bool) {
})

routineCount = runtime.NumGoroutine()
if routineCount > 100 {
if routineCount > 150 {
b.Errorf("go routine count: %d", routineCount)
} else {
log.Infof("go routine count: %d", routineCount)
Expand Down
1 change: 1 addition & 0 deletions sqlchain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ func (c *Chain) billing(h int32, node *blockNode) (ub *types.UpdateBilling, err
ub = types.NewUpdateBilling(&types.UpdateBillingHeader{
Users: make([]*types.UserCost, len(usersMap)),
})
ub.Version = int32(ub.HSPDefaultVersion())

i = 0
j = 0
Expand Down
1 change: 1 addition & 0 deletions types/updatebilling.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type UpdateBillingHeader struct {
Nonce pi.AccountNonce
Users []*UserCost
Range Range
Version int32 `hsp:"v,version"`
}

// UpdateBilling defines the UpdateBilling transaction.
Expand Down
73 changes: 37 additions & 36 deletions types/updatebilling_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions types/updatebilling_updatebillingheader_9ef447_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions types/updatebilling_updatebillingheader_9ef447_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions types/updatebilling_updatebillingheader_oldver_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions types/updatebilling_updatebillingheader_oldver_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.