|
|
@ -155,16 +155,6 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) { |
|
|
|
consensus.mutex.Lock() |
|
|
|
consensus.mutex.Lock() |
|
|
|
defer consensus.mutex.Unlock() |
|
|
|
defer consensus.mutex.Unlock() |
|
|
|
|
|
|
|
|
|
|
|
if consensus.BlockVerifier == nil { |
|
|
|
|
|
|
|
consensus.getLogger().Debug().Msg("[onPrepared] consensus received message before init. Ignoring") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if err := consensus.BlockVerifier(&blockObj); err != nil { |
|
|
|
|
|
|
|
consensus.getLogger().Error().Err(err).Msg("[OnPrepared] Block verification failed") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
consensus.FBFTLog.MarkBlockVerified(&blockObj) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
consensus.FBFTLog.AddBlock(&blockObj) |
|
|
|
consensus.FBFTLog.AddBlock(&blockObj) |
|
|
|
// add block field
|
|
|
|
// add block field
|
|
|
|
blockPayload := make([]byte, len(recvMsg.Block)) |
|
|
|
blockPayload := make([]byte, len(recvMsg.Block)) |
|
|
@ -178,6 +168,16 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) { |
|
|
|
Hex("blockHash", recvMsg.BlockHash[:]). |
|
|
|
Hex("blockHash", recvMsg.BlockHash[:]). |
|
|
|
Msg("[OnPrepared] Prepared message and block added") |
|
|
|
Msg("[OnPrepared] Prepared message and block added") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if consensus.BlockVerifier == nil { |
|
|
|
|
|
|
|
consensus.getLogger().Debug().Msg("[onPrepared] consensus received message before init. Ignoring") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if err := consensus.BlockVerifier(&blockObj); err != nil { |
|
|
|
|
|
|
|
consensus.getLogger().Error().Err(err).Msg("[OnPrepared] Block verification failed") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
consensus.FBFTLog.MarkBlockVerified(&blockObj) |
|
|
|
|
|
|
|
|
|
|
|
if consensus.checkViewID(recvMsg) != nil { |
|
|
|
if consensus.checkViewID(recvMsg) != nil { |
|
|
|
if consensus.current.Mode() == Normal { |
|
|
|
if consensus.current.Mode() == Normal { |
|
|
|
consensus.getLogger().Debug(). |
|
|
|
consensus.getLogger().Debug(). |
|
|
|