aboutsummaryrefslogtreecommitdiffstats
path: root/consensus
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-09-10 20:00:54 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-09-10 20:00:54 +0800
commitbcfb7f58b93e6fb5f3da0000672adee80fd6a485 (patch)
treec6f0f1289f8b192a51cb5f0ce6bda6a2d2f091a2 /consensus
parentae992a5d73311742389fce3f855575be98fc6972 (diff)
downloaddexon-bcfb7f58b93e6fb5f3da0000672adee80fd6a485.tar
dexon-bcfb7f58b93e6fb5f3da0000672adee80fd6a485.tar.gz
dexon-bcfb7f58b93e6fb5f3da0000672adee80fd6a485.tar.bz2
dexon-bcfb7f58b93e6fb5f3da0000672adee80fd6a485.tar.lz
dexon-bcfb7f58b93e6fb5f3da0000672adee80fd6a485.tar.xz
dexon-bcfb7f58b93e6fb5f3da0000672adee80fd6a485.tar.zst
dexon-bcfb7f58b93e6fb5f3da0000672adee80fd6a485.zip
consensus/clique: only trust snapshot for genesis or les checkpoint
Diffstat (limited to 'consensus')
-rw-r--r--consensus/clique/clique.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go
index 547290984..0ff72e55c 100644
--- a/consensus/clique/clique.go
+++ b/consensus/clique/clique.go
@@ -388,7 +388,7 @@ func (c *Clique) snapshot(chain consensus.ChainReader, number uint64, hash commo
}
}
// If we're at an checkpoint block, make a snapshot if it's known
- if number%c.config.Epoch == 0 {
+ if number == 0 || (number%c.config.Epoch == 0 && chain.GetHeaderByNumber(number-1) == nil) {
checkpoint := chain.GetHeaderByNumber(number)
if checkpoint != nil {
hash := checkpoint.Hash()