les: limit state ODR retrievals to the last 100 blocks (#17744)
This commit is contained in:
committed by
Martin Holst Swende
parent
96fd50be10
commit
b7bbe66b19
@ -67,7 +67,7 @@ type peer struct {
|
||||
sendQueue *execQueue
|
||||
|
||||
poolEntry *poolEntry
|
||||
hasBlock func(common.Hash, uint64) bool
|
||||
hasBlock func(common.Hash, uint64, bool) bool
|
||||
responseErrors int
|
||||
|
||||
fcClient *flowcontrol.ClientNode // nil if the peer is server only
|
||||
@ -171,11 +171,11 @@ func (p *peer) GetRequestCost(msgcode uint64, amount int) uint64 {
|
||||
}
|
||||
|
||||
// HasBlock checks if the peer has a given block
|
||||
func (p *peer) HasBlock(hash common.Hash, number uint64) bool {
|
||||
func (p *peer) HasBlock(hash common.Hash, number uint64, hasState bool) bool {
|
||||
p.lock.RLock()
|
||||
hasBlock := p.hasBlock
|
||||
p.lock.RUnlock()
|
||||
return hasBlock != nil && hasBlock(hash, number)
|
||||
return hasBlock != nil && hasBlock(hash, number, hasState)
|
||||
}
|
||||
|
||||
// SendAnnounce announces the availability of a number of blocks through
|
||||
|
Reference in New Issue
Block a user