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
|
bytes int
|
||||||
bodies []rlp.RawValue
|
bodies []rlp.RawValue
|
||||||
)
|
)
|
||||||
for bytes < softResponseLimit && len(bodies) < downloader.MaxBlockFetch {
|
for bytes < softResponseLimit && len(bodies) < downloader.MaxBodyFetch {
|
||||||
// Retrieve the hash of the next block
|
// Retrieve the hash of the next block
|
||||||
if err := msgStream.Decode(&hash); err == rlp.EOL {
|
if err := msgStream.Decode(&hash); err == rlp.EOL {
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -469,11 +469,9 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// Retrieve the requested block body, stopping if enough was found
|
// Retrieve the requested block body, stopping if enough was found
|
||||||
if number := rawdb.ReadHeaderNumber(pm.chainDb, hash); number != nil {
|
if data := pm.blockchain.(*core.BlockChain).GetBodyRLP(hash); len(data) != 0 {
|
||||||
if data := rawdb.ReadBodyRLP(pm.chainDb, hash, *number); len(data) != 0 {
|
bodies = append(bodies, data)
|
||||||
bodies = append(bodies, data)
|
bytes += len(data)
|
||||||
bytes += len(data)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bv, rcost := p.fcClient.RequestProcessed(costs.baseCost + uint64(reqCnt)*costs.reqCost)
|
bv, rcost := p.fcClient.RequestProcessed(costs.baseCost + uint64(reqCnt)*costs.reqCost)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue