mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-07-03 11:22:30 +00: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 {
|
if err != nil {
|
||||||
return false, err
|
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.
|
// IsKnownOrphan returns whether the passed hash is currently a known orphan.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user