From daa1923141c7f87dce02b8eff59d45c328a222ca Mon Sep 17 00:00:00 2001 From: Zsolt Felfoldi Date: Thu, 14 Jun 2018 11:24:30 +0200 Subject: [PATCH] eth, les: use the same method to serve block bodies --- eth/handler.go | 2 +- les/handler.go | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/eth/handler.go b/eth/handler.go index 9bcc1e35cf..59a8aaed5e 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -407,7 +407,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { bytes int bodies []rlp.RawValue ) - for bytes < softResponseLimit && len(bodies) < downloader.MaxBlockFetch { + for bytes < softResponseLimit && len(bodies) < downloader.MaxBodyFetch { // Retrieve the hash of the next block if err := msgStream.Decode(&hash); err == rlp.EOL { break diff --git a/les/handler.go b/les/handler.go index 7d2f0292e2..9f2491d5cb 100644 --- a/les/handler.go +++ b/les/handler.go @@ -469,11 +469,9 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { break } // Retrieve the requested block body, stopping if enough was found - if number := rawdb.ReadHeaderNumber(pm.chainDb, hash); number != nil { - if data := rawdb.ReadBodyRLP(pm.chainDb, hash, *number); len(data) != 0 { - bodies = append(bodies, data) - bytes += len(data) - } + if data := pm.blockchain.(*core.BlockChain).GetBodyRLP(hash); len(data) != 0 { + bodies = append(bodies, data) + bytes += len(data) } } bv, rcost := p.fcClient.RequestProcessed(costs.baseCost + uint64(reqCnt)*costs.reqCost)