mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
les: remove delayed announcement
This commit is contained in:
parent
4a6959a839
commit
36bfbc620e
2 changed files with 3 additions and 11 deletions
|
|
@ -242,7 +242,7 @@ func (f *lightFetcher) unregisterPeer(p *peer) {
|
|||
|
||||
// announce processes a new announcement message received from a peer, adding new
|
||||
// nodes to the peer's block tree and removing old nodes if necessary
|
||||
func (f *lightFetcher) announce(p *peer, head *announceData, acceptNonMonotonic bool) {
|
||||
func (f *lightFetcher) announce(p *peer, head *announceData) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
p.Log().Debug("Received new announcement", "number", head.Number, "hash", head.Hash, "reorg", head.ReorgDepth)
|
||||
|
|
@ -254,9 +254,6 @@ func (f *lightFetcher) announce(p *peer, head *announceData, acceptNonMonotonic
|
|||
}
|
||||
|
||||
if fp.lastAnnounced != nil && head.Td.Cmp(fp.lastAnnounced.td) <= 0 {
|
||||
if acceptNonMonotonic {
|
||||
return
|
||||
}
|
||||
// announced tds should be strictly monotonic
|
||||
p.Log().Debug("Received non-monotonic td", "current", head.Td, "previous", fp.lastAnnounced.td)
|
||||
go f.pm.removePeer(p.id)
|
||||
|
|
|
|||
|
|
@ -318,12 +318,7 @@ func (pm *ProtocolManager) handle(p *peer) error {
|
|||
p.lock.Lock()
|
||||
head := p.headInfo
|
||||
p.lock.Unlock()
|
||||
if pm.fetcher != nil {
|
||||
go func() {
|
||||
time.Sleep(time.Second * 2)
|
||||
pm.fetcher.announce(p, head, true)
|
||||
}()
|
||||
}
|
||||
pm.fetcher.announce(p, head)
|
||||
|
||||
if p.poolEntry != nil {
|
||||
pm.serverPool.registered(p.poolEntry)
|
||||
|
|
@ -419,7 +414,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
|
|||
|
||||
p.Log().Trace("Announce message content", "number", req.Number, "hash", req.Hash, "td", req.Td, "reorg", req.ReorgDepth)
|
||||
if pm.fetcher != nil {
|
||||
pm.fetcher.announce(p, &req, false)
|
||||
pm.fetcher.announce(p, &req)
|
||||
}
|
||||
|
||||
case GetBlockHeadersMsg:
|
||||
|
|
|
|||
Loading…
Reference in a new issue