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.
This commit is contained in:
David Hill 2016-07-25 11:16:57 -04:00 committed by Dave Collins
parent 00ebb9d14d
commit 61a15f6f1b

View File

@ -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.