From 61a15f6f1bea14cb47aa4d70dd3d38dee5e7c701 Mon Sep 17 00:00:00 2001 From: David Hill Date: Mon, 25 Jul 2016 11:16:57 -0400 Subject: [PATCH] blockchain: optimize HaveBlock (#720) If a block is known to exist in the memory chain or database then there is no need to check the orphan pool. --- blockchain/chain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockchain/chain.go b/blockchain/chain.go index aa1f407e..f265a516 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -238,7 +238,7 @@ func (b *BlockChain) HaveBlock(hash *wire.ShaHash) (bool, error) { if err != nil { return false, err } - return b.IsKnownOrphan(hash) || exists, nil + return exists || b.IsKnownOrphan(hash), nil } // IsKnownOrphan returns whether the passed hash is currently a known orphan.