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

@ -51,6 +51,8 @@ const (
type LesServer struct {
lesCommons
archiveMode bool // Flag whether the ethereum node runs in archive mode.
fcManager *flowcontrol.ClientManager // nil if our node is client only
costTracker *costTracker
testCost uint64
@ -93,7 +95,8 @@ func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) {
nil,
quitSync,
new(sync.WaitGroup),
config.ULC, eth.Synced)
config.ULC,
eth.Synced)
if err != nil {
return nil, err
}
@ -120,6 +123,7 @@ func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) {
bloomTrieIndexer: light.NewBloomTrieIndexer(eth.ChainDb(), nil, params.BloomBitsBlocks, params.BloomTrieFrequency),
protocolManager: pm,
},
archiveMode: eth.ArchiveMode(),
quitSync: quitSync,
lesTopics: lesTopics,
onlyAnnounce: config.OnlyAnnounce,