Skip to content

Commit

Permalink
[light-node] fix creation of new version on db
Browse files Browse the repository at this point in the history
  • Loading branch information
kroggen committed Jul 8, 2024
1 parent 939bfca commit b95c38c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 2 additions & 5 deletions chain/chainhandle.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,11 +782,8 @@ func (e *blockExecutor) execute() error {
// commit state changes and update state root
func (e *blockExecutor) commit() error {

// if this is a light node
if e.sdb.store.Type() == "deldeldb" {
// create a new "version" on the database
e.sdb.store.IoCtl("new-version")
}
// if this is a light node, create a new version on the database
e.sdb.NewVersion()

// commit changes to the state db
if err := e.BlockState.Commit(); err != nil {
Expand Down
6 changes: 6 additions & 0 deletions state/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ func (sdb *ChainStateDB) SetGenesis(genesis *types.Genesis, bpInit func(*statedb
return nil
}

func (sdb *ChainStateDB) NewVersion() {
if sdb.store.Type() == "deldeldb" {
sdb.store.IoCtl("new-version")
}
}

// Apply specific blockstate to statedb of main chain
func (sdb *ChainStateDB) Apply(bstate *BlockState) error {
sdb.Lock()
Expand Down

0 comments on commit b95c38c

Please sign in to comment.