mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-10 23:14:27 +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
|
// 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
|
snap, _ := loadSnapshot(x.db, lastGapHeader.Hash())
|
||||||
checkpointHeader := chain.GetHeaderByNumber(checkpointBlockNumber)
|
|
||||||
|
|
||||||
lastGapNum := checkpointBlockNumber - x.config.Gap
|
if snap == nil {
|
||||||
lastGapHeader := chain.GetHeaderByNumber(lastGapNum)
|
checkpointHeader := chain.GetHeaderByNumber(x.config.V2.SwitchBlock.Uint64())
|
||||||
|
|
||||||
log.Info("[Initial] init first snapshot")
|
log.Info("[Initial] init first snapshot")
|
||||||
_, _, masternodes, err := x.getExtraFields(checkpointHeader)
|
_, _, masternodes, err := x.getExtraFields(checkpointHeader)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue