mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
eth, les: use the same method to serve block bodies
This commit is contained in:
parent
cf059f15cb
commit
daa1923141
2 changed files with 4 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -469,13 +469,11 @@ 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 {
|
||||
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)
|
||||
pm.server.fcCostStats.update(msg.Code, uint64(reqCnt), rcost)
|
||||
return p.SendBlockBodiesRLP(req.ReqID, bv, bodies)
|
||||
|
|
|
|||
Loading…
Reference in a new issue