Browse Source

consensus/clique: only trust snapshot for genesis or les checkpoint

Péter Szilágyi 7 năm trước cách đây
mục cha
commit
bcfb7f58b9
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      consensus/clique/clique.go

+ 1 - 1
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()