use empty extended commit when not enabled

This commit is contained in:
William Banfield
2022-05-20 10:23:25 -04:00
parent 6889f77807
commit 4be4e96ceb

View File

@@ -200,15 +200,11 @@ func (r *Reactor) respondToPeer(ctx context.Context, msg *bcproto.BlockRequest,
var extCommit *types.ExtendedCommit
if state.ConsensusParams.ABCI.VoteExtensionsEnabled(msg.Height) {
extCommit = r.store.LoadBlockExtendedCommit(msg.Height)
} else {
c := r.store.LoadBlockCommit(msg.Height)
if extCommit != nil {
extCommit = c.WrappedExtendedCommit()
if extCommit == nil {
return fmt.Errorf("found block in store with no extended commit: %v", block)
}
}
if extCommit == nil {
return fmt.Errorf("found block in store with no commit and no extended commit: %v", block)
}
blockProto, err := block.ToProto()
if err != nil {
return fmt.Errorf("failed to convert block to protobuf: %w", err)