Merge pull request #1136 from chaosma/master

turn on verifyseal checking
pull/1138/head
Rongjian Lan 5 years ago committed by GitHub
commit 75ec14c800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      consensus/consensus_service.go
  2. 4
      consensus/consensus_v2.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)

@ -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
}

Loading…
Cancel
Save