mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-16 17:03:46 +00:00
core: use numberCache in HasHeader
numberCache has higher capacity, increasing the odds of finding the header without a database lookup.
This commit is contained in:
parent
d4486f0cb0
commit
1436f5111e
1 changed files with 1 additions and 1 deletions
|
|
@ -363,7 +363,7 @@ func (hc *HeaderChain) GetHeaderByHash(hash common.Hash) *types.Header {
|
|||
|
||||
// HasHeader checks if a block header is present in the database or not.
|
||||
func (hc *HeaderChain) HasHeader(hash common.Hash, number uint64) bool {
|
||||
if _, ok := hc.headerCache.Get(hash); ok {
|
||||
if hc.numberCache.Contains(hash) || hc.headerCache.Contains(hash) {
|
||||
return true
|
||||
}
|
||||
ok, _ := hc.chainDb.Has(headerKey(hash, number))
|
||||
|
|
|
|||
Loading…
Reference in a new issue