Skip to content

Commit

Permalink
add TODO about createSnapshot
Browse files Browse the repository at this point in the history
* however, before TODO, keep creating istanbul snapshot
  • Loading branch information
yoomee1313 committed Dec 19, 2024
1 parent 5af51ea commit 0a5fc40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2151,6 +2151,11 @@ func (bc *BlockChain) insertChain(chain types.Blocks) (int, []interface{}, []*ty
}
}

// update governance CurrentSet if it is at an epoch block
if bc.engine.CreateSnapshot(bc, block.NumberU64(), block.Hash(), nil) != nil {
return i, events, coalescedLogs, err
}

// update governance parameters
if istanbul, ok := bc.engine.(consensus.Istanbul); ok {
if err = istanbul.UpdateParam(block.NumberU64()); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ type Engine interface {
// Protocol returns the protocol for this consensus
Protocol() Protocol

// TODO-kaiax-valset: delete CreateSnapshot which is called after post insert block
// e.g. insertChain, worker.wait, New()
// CreateSnapshot does not return a snapshot but creates a new snapshot if not exists at a given point in time.
CreateSnapshot(chain ChainReader, number uint64, hash common.Hash, parents []*types.Header) error

Expand Down

0 comments on commit 0a5fc40

Please sign in to comment.