diff --git a/consensus/view_change_construct.go b/consensus/view_change_construct.go index 234433f9c..358f091b7 100644 --- a/consensus/view_change_construct.go +++ b/consensus/view_change_construct.go @@ -113,18 +113,19 @@ func (vc *viewChange) GetPreparedBlock(fbftlog *FBFTLog, hash [32]byte) ([]byte, vc.vcLock.RLock() defer vc.vcLock.RUnlock() - if !vc.isM1PayloadEmpty() { - block := fbftlog.GetBlockByHash(hash) - if block != nil { - encodedBlock, err := rlp.EncodeToBytes(block) - if err != nil || len(encodedBlock) == 0 { - vc.getLogger().Err(err).Msg("[GetPreparedBlock] Failed encoding prepared block") - return vc.m1Payload, nil - } - return vc.m1Payload, encodedBlock + if vc.isM1PayloadEmpty() { + return nil, nil + } + + if block := fbftlog.GetBlockByHash(hash); block != nil { + encodedBlock, err := rlp.EncodeToBytes(block) + if err != nil || len(encodedBlock) == 0 { + return nil, nil } + return vc.m1Payload, encodedBlock } - return vc.m1Payload, nil + + return nil, nil } // GetM2Bitmap returns the nilBitmap as M2Bitmap