Fix for consensus stuck. (#4307)

* Added check for block validity.

* Starts new view change if block invalid.

* Revert "Starts new view change if block invalid."

This reverts commit e889fa5da2e0780f087ab7dae5106b96287706db.
pull/4316/head
Konstantin 2 years ago committed by GitHub
parent 9c84332c66
commit c960e076d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      consensus/view_change_construct.go

@ -109,6 +109,10 @@ func (vc *viewChange) GetPreparedBlock(fbftlog *FBFTLog) ([]byte, []byte) {
// First 32 bytes of m1 payload is the correct block hash
copy(blockHash[:], vc.GetM1Payload())
if !fbftlog.IsBlockVerified(blockHash) {
return nil, nil
}
if block := fbftlog.GetBlockByHash(blockHash); block != nil {
encodedBlock, err := rlp.EncodeToBytes(block)
if err != nil || len(encodedBlock) == 0 {

Loading…
Cancel
Save