From 5a42b5c7aed915759b249387a91ffbdda1d74590 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 10 Aug 2020 16:51:12 +0300 Subject: [PATCH] network: correct block addition check Fixes missing an error on block addition when the header actually went it, but the block didn't. --- pkg/network/blockqueue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/blockqueue.go b/pkg/network/blockqueue.go index ed6eac1ae..179c468a1 100644 --- a/pkg/network/blockqueue.go +++ b/pkg/network/blockqueue.go @@ -48,7 +48,7 @@ func (bq *blockQueue) run() { err := bq.chain.AddBlock(minblock) if err != nil { // 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", zap.String("error", err.Error()), zap.Uint32("blockHeight", bq.chain.BlockHeight()),