mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
initial snapshot when there is no snapshot (#86)
This commit is contained in:
parent
5fffa0cd43
commit
2b40d1337f
1 changed files with 5 additions and 5 deletions
|
|
@ -171,13 +171,13 @@ func (x *XDPoS_v2) Initial(chain consensus.ChainReader, header *types.Header) er
|
|||
}
|
||||
|
||||
// Initial first v2 snapshot
|
||||
if header.Number.Uint64() < x.config.V2.SwitchBlock.Uint64()+x.config.Gap {
|
||||
lastGapNum := x.config.V2.SwitchBlock.Uint64() - x.config.Gap
|
||||
lastGapHeader := chain.GetHeaderByNumber(lastGapNum)
|
||||
|
||||
checkpointBlockNumber := header.Number.Uint64() - header.Number.Uint64()%x.config.Epoch
|
||||
checkpointHeader := chain.GetHeaderByNumber(checkpointBlockNumber)
|
||||
snap, _ := loadSnapshot(x.db, lastGapHeader.Hash())
|
||||
|
||||
lastGapNum := checkpointBlockNumber - x.config.Gap
|
||||
lastGapHeader := chain.GetHeaderByNumber(lastGapNum)
|
||||
if snap == nil {
|
||||
checkpointHeader := chain.GetHeaderByNumber(x.config.V2.SwitchBlock.Uint64())
|
||||
|
||||
log.Info("[Initial] init first snapshot")
|
||||
_, _, masternodes, err := x.getExtraFields(checkpointHeader)
|
||||
|
|
|
|||
Loading…
Reference in a new issue