Skip to content

Commit

Permalink
rename bulk.DiscardLast() -> bulk.Discard()
Browse files Browse the repository at this point in the history
  • Loading branch information
kroggen committed Jul 8, 2024
1 parent cd5d34a commit 4d1f1d0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion chain/chaindb.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func (cdb *ChainDB) swapChainMapping(newBlocks []*types.Block) error {
var blockIdx []byte

bulk := cdb.store.NewBulk()
defer bulk.DiscardLast()
defer bulk.Discard()

//make newTx because of batchsize limit of DB
for i := len(newBlocks) - 1; i >= 0; i-- {
Expand Down
2 changes: 1 addition & 1 deletion chain/chaindbForRaft.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (cdb *ChainDB) ClearWAL() {
logger.Debug().Uint64("last", lastIdx).Msg("reset raft entries from datafiles")

bulk := cdb.store.NewBulk()
defer bulk.DiscardLast()
defer bulk.Discard()

for i := lastIdx; i >= 1; i-- {
bulk.Delete(dbkey.RaftEntry(i))
Expand Down
2 changes: 1 addition & 1 deletion chain/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (rm *ReorgMarker) RecoverChainMapping(cdb *ChainDB) error {
}

bulk := cdb.store.NewBulk()
defer bulk.DiscardLast()
defer bulk.Discard()

var tmpBlkNo types.BlockNo
var tmpBlk *types.Block
Expand Down
2 changes: 1 addition & 1 deletion chain/reorg.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func (reorg *reorganizer) swapTxMapping() error {

// delete old tx mapping
bulk := cdb.store.NewBulk()
defer bulk.DiscardLast()
defer bulk.Discard()

for _, oldTx := range oldTxs {
bulk.Delete(oldTx.Hash)
Expand Down
4 changes: 2 additions & 2 deletions state/statedb/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ func (states *StateDB) Commit() error {
for _, storage := range states.Cache.storages {
// stage changes
if err := storage.stage(bulk); err != nil {
bulk.DiscardLast()
bulk.Discard()
return err
}
}
if err := states.stage(bulk); err != nil {
bulk.DiscardLast()
bulk.Discard()
return err
}
bulk.Flush()
Expand Down

0 comments on commit 4d1f1d0

Please sign in to comment.