eth, p2p: reserve half peer slots for snap peers during snap sync (#22171)

* eth, p2p: reserve half peer slots for snap peers during snap sync

* eth: less logging

* eth: rework the eth/snap peer reservation logic

* eth: rework the eth/snap peer reservation logic (again)
This commit is contained in:
Martin Holst Swende
2021-01-25 19:06:52 +01:00
committed by GitHub
parent adf130def8
commit d2779ed7ac
4 changed files with 37 additions and 3 deletions

View File

@ -329,6 +329,10 @@ func (h *handler) doSync(op *chainSyncOp) error {
log.Info("Fast sync complete, auto disabling")
atomic.StoreUint32(&h.fastSync, 0)
}
if atomic.LoadUint32(&h.snapSync) == 1 {
log.Info("Snap sync complete, auto disabling")
atomic.StoreUint32(&h.snapSync, 0)
}
// If we've successfully finished a sync cycle and passed any required checkpoint,
// enable accepting transactions from the network.
head := h.chain.CurrentBlock()