diff options
author | Felföldi Zsolt <zsfelfoldi@gmail.com> | 2018-10-01 21:14:53 +0800 |
---|---|---|
committer | Martin Holst Swende <martin@swende.se> | 2018-10-01 21:14:53 +0800 |
commit | b7bbe66b19fb19b95053977586e619a40478a7d8 (patch) | |
tree | ea51832839f8bd17a8c3c8774866da5ed3260c29 /les/odr_requests.go | |
parent | 96fd50be10885c9b3033404df698177fdb63d036 (diff) | |
download | dexon-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/odr_requests.go')
-rw-r--r-- | les/odr_requests.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/les/odr_requests.go b/les/odr_requests.go index 77b1b6d0c..0f2e5dd9e 100644 --- a/les/odr_requests.go +++ b/les/odr_requests.go @@ -84,7 +84,7 @@ func (r *BlockRequest) GetCost(peer *peer) uint64 { // CanSend tells if a certain peer is suitable for serving the given request func (r *BlockRequest) CanSend(peer *peer) bool { - return peer.HasBlock(r.Hash, r.Number) + return peer.HasBlock(r.Hash, r.Number, false) } // Request sends an ODR request to the LES network (implementation of LesOdrRequest) @@ -140,7 +140,7 @@ func (r *ReceiptsRequest) GetCost(peer *peer) uint64 { // CanSend tells if a certain peer is suitable for serving the given request func (r *ReceiptsRequest) CanSend(peer *peer) bool { - return peer.HasBlock(r.Hash, r.Number) + return peer.HasBlock(r.Hash, r.Number, false) } // Request sends an ODR request to the LES network (implementation of LesOdrRequest) @@ -202,7 +202,7 @@ func (r *TrieRequest) GetCost(peer *peer) uint64 { // CanSend tells if a certain peer is suitable for serving the given request func (r *TrieRequest) CanSend(peer *peer) bool { - return peer.HasBlock(r.Id.BlockHash, r.Id.BlockNumber) + return peer.HasBlock(r.Id.BlockHash, r.Id.BlockNumber, true) } // Request sends an ODR request to the LES network (implementation of LesOdrRequest) @@ -272,7 +272,7 @@ func (r *CodeRequest) GetCost(peer *peer) uint64 { // CanSend tells if a certain peer is suitable for serving the given request func (r *CodeRequest) CanSend(peer *peer) bool { - return peer.HasBlock(r.Id.BlockHash, r.Id.BlockNumber) + return peer.HasBlock(r.Id.BlockHash, r.Id.BlockNumber, true) } // Request sends an ODR request to the LES network (implementation of LesOdrRequest) |