mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: reuse local head number
This commit is contained in:
parent
cd5003a1da
commit
ec4d1d57cf
1 changed files with 6 additions and 4 deletions
|
|
@ -700,8 +700,9 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
|
|||
}
|
||||
// Refuse to search stale state data in the database since looking for
|
||||
// a non-exist key is kind of expensive.
|
||||
if !pm.server.archiveMode && header.Number.Uint64()+core.TriesInMemory <= pm.blockchain.CurrentHeader().Number.Uint64() {
|
||||
p.Log().Debug("Reject stale code request", "number", header.Number.Uint64(), "head", pm.blockchain.CurrentHeader().Number.Uint64())
|
||||
local := pm.blockchain.CurrentHeader().Number.Uint64()
|
||||
if !pm.server.archiveMode && header.Number.Uint64()+core.TriesInMemory <= local {
|
||||
p.Log().Debug("Reject stale code request", "number", header.Number.Uint64(), "head", local)
|
||||
continue
|
||||
}
|
||||
triedb := pm.blockchain.StateCache().TrieDB()
|
||||
|
|
@ -860,8 +861,9 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
|
|||
}
|
||||
// Refuse to search stale state data in the database since looking for
|
||||
// a non-exist key is kind of expensive.
|
||||
if !pm.server.archiveMode && header.Number.Uint64()+core.TriesInMemory <= pm.blockchain.CurrentHeader().Number.Uint64() {
|
||||
p.Log().Debug("Reject stale trie request", "number", header.Number.Uint64(), "head", pm.blockchain.CurrentHeader().Number.Uint64())
|
||||
local := pm.blockchain.CurrentHeader().Number.Uint64()
|
||||
if !pm.server.archiveMode && header.Number.Uint64()+core.TriesInMemory <= local {
|
||||
p.Log().Debug("Reject stale trie request", "number", header.Number.Uint64(), "head", local)
|
||||
continue
|
||||
}
|
||||
root = header.Root
|
||||
|
|
|
|||
Loading…
Reference in a new issue