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
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue