network: correct block addition check

Fixes missing an error on block addition when the header actually went it, but
the block didn't.
This commit is contained in:
Roman Khimov 2020-08-10 16:51:12 +03:00
parent 0b96e6a048
commit 5a42b5c7ae

View file

@ -48,7 +48,7 @@ func (bq *blockQueue) run() {
err := bq.chain.AddBlock(minblock) err := bq.chain.AddBlock(minblock)
if err != nil { if err != nil {
// The block might already be added by consensus. // The block might already be added by consensus.
if _, errget := bq.chain.GetBlock(minblock.Hash()); errget != nil { if bq.chain.BlockHeight() < minblock.Index {
bq.log.Warn("blockQueue: failed adding block into the blockchain", bq.log.Warn("blockQueue: failed adding block into the blockchain",
zap.String("error", err.Error()), zap.String("error", err.Error()),
zap.Uint32("blockHeight", bq.chain.BlockHeight()), zap.Uint32("blockHeight", bq.chain.BlockHeight()),