diff --git a/consensus/consensus_service.go b/consensus/consensus_service.go index f77eef498..5cd61c366 100644 --- a/consensus/consensus_service.go +++ b/consensus/consensus_service.go @@ -264,6 +264,9 @@ func retrievePublicKeysFromLastBlock(bc consensus_engine.ChainReader, header *ty // VerifySeal implements consensus.Engine, checking whether the given block satisfies // the PoS difficulty requirements, i.e. >= 2f+1 valid signatures from the committee func (consensus *Consensus) VerifySeal(chain consensus_engine.ChainReader, header *types.Header) error { + if chain.CurrentHeader().Number.Uint64() <= uint64(1) { + return nil + } publicKeys, err := retrievePublicKeysFromLastBlock(chain, header) if err != nil { return ctxerror.New("[VerifySeal] Cannot retrieve publickeys from last block").WithCause(err) diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index e204afec1..a717c41ea 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -164,7 +164,7 @@ func (consensus *Consensus) onAnnounce(msg *msg_pb.Message) { return } if consensus.mode.Mode() == Normal { - if err = consensus.VerifyHeader(consensus.ChainReader, &headerObj, false); err != nil { + if err = consensus.VerifyHeader(consensus.ChainReader, &headerObj, true); err != nil { consensus.getLogger().Warn("[OnAnnounce] Block content is not verified successfully", "error", err, "inChain", consensus.ChainReader.CurrentHeader().Number, "MsgBlockNum", headerObj.Number) return } @@ -397,7 +397,7 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) { return } if consensus.mode.Mode() == Normal { - if err := consensus.VerifyHeader(consensus.ChainReader, blockObj.Header(), false); err != nil { + if err := consensus.VerifyHeader(consensus.ChainReader, blockObj.Header(), true); err != nil { consensus.getLogger().Warn("[OnPrepared] Block header is not verified successfully", "error", err, "inChain", consensus.ChainReader.CurrentHeader().Number, "MsgBlockNum", blockObj.Header().Number) return }