aboutsummaryrefslogtreecommitdiffstats
path: root/les/peer.go
diff options
context:
space:
mode:
authorFelföldi Zsolt <zsfelfoldi@gmail.com>2018-10-01 21:14:53 +0800
committerMartin Holst Swende <martin@swende.se>2018-10-01 21:14:53 +0800
commitb7bbe66b19fb19b95053977586e619a40478a7d8 (patch)
treeea51832839f8bd17a8c3c8774866da5ed3260c29 /les/peer.go
parent96fd50be10885c9b3033404df698177fdb63d036 (diff)
downloaddexon-b7bbe66b19fb19b95053977586e619a40478a7d8.tar
dexon-b7bbe66b19fb19b95053977586e619a40478a7d8.tar.gz
dexon-b7bbe66b19fb19b95053977586e619a40478a7d8.tar.bz2
dexon-b7bbe66b19fb19b95053977586e619a40478a7d8.tar.lz
dexon-b7bbe66b19fb19b95053977586e619a40478a7d8.tar.xz
dexon-b7bbe66b19fb19b95053977586e619a40478a7d8.tar.zst
dexon-b7bbe66b19fb19b95053977586e619a40478a7d8.zip
les: limit state ODR retrievals to the last 100 blocks (#17744)
Diffstat (limited to 'les/peer.go')
-rw-r--r--les/peer.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/les/peer.go b/les/peer.go
index 1f343847e..678384f0e 100644
--- a/les/peer.go
+++ b/les/peer.go
@@ -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