add nil check for block load

This commit is contained in:
William Banfield
2022-05-18 16:53:55 -04:00
parent 4194d4da46
commit 10078f39d6
+3 -1
View File
@@ -202,7 +202,9 @@ func (r *Reactor) respondToPeer(ctx context.Context, msg *bcproto.BlockRequest,
extCommit = r.store.LoadBlockExtendedCommit(msg.Height)
} else {
c := r.store.LoadBlockCommit(msg.Height)
extCommit = c.WrappedExtendedCommit()
if extCommit != nil {
extCommit = c.WrappedExtendedCommit()
}
}
if extCommit == nil {
return fmt.Errorf("found block in store with no commit and no extended commit: %v", block)