eth, les: reject stale request (#19689)

* eth, les: reject stale request

* les: reuse local head number
This commit is contained in:
gary rong
2019-06-11 15:40:32 +08:00
committed by Péter Szilágyi
parent 3d3e83ecff
commit c0a034ec89
5 changed files with 90 additions and 2 deletions

View File

@ -551,7 +551,14 @@ func (p *peer) Handshake(td *big.Int, head common.Hash, headNum uint64, genesis
send = send.add("serveHeaders", nil)
send = send.add("serveChainSince", uint64(0))
send = send.add("serveStateSince", uint64(0))
send = send.add("serveRecentState", uint64(core.TriesInMemory-4))
// If local ethereum node is running in archive mode, advertise ourselves we have
// all version state data. Otherwise only recent state is available.
stateRecent := uint64(core.TriesInMemory - 4)
if server.archiveMode {
stateRecent = 0
}
send = send.add("serveRecentState", stateRecent)
send = send.add("txRelay", nil)
}
send = send.add("flowControl/BL", server.defParams.BufLimit)