mirror of
https://github.com/btcsuite/btcd.git
synced 2025-01-19 05:33:36 +01:00
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:
parent
00ebb9d14d
commit
61a15f6f1b
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user