Node peer recovery after network outage: seeds, discovery, and sync selection #63
adamantmm
started this conversation in
ADM Nodes, Delegates & Pools
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ADAMANT nodes maintain peer connectivity through three separate mechanisms that are easy to confuse when reading console logs after a network outage. This note explains how they interact, why sync can stall even while seed peers are still being contacted, and what operators should expect during recovery.
Background
A node keeps an in-memory peer table. Entries come from:
peers.list(config)GET /peer/listSeed peers are "frozen": they are never removed from the table, even when requests fail.
Peer states
Each peer has a state:
BANNED(0)DISCONNECTED(1)CONNECTED(2)On request failures, a peer's success rate drops. When a previously
CONNECTEDpeer falls below 80% success, its state degrades toDISCONNECTED. Network timeouts (ECONNABORTED) do not remove the peer; they only reduce the success rate.Three parallel mechanisms
1. Seed ping (quiet)
On startup and every ~5 seconds, the node pings every seed peer from config (
GET /peer/height). Failures are logged at trace level and are usually invisible in default console output.A successful ping promotes the peer back to
CONNECTED.2. Peer discovery (loud)
Every ~5 seconds, the node picks one random peer from memory (states
DISCONNECTEDorCONNECTED) and requestsGET /peer/listto learn new addresses.If that single random pick times out, the console shows:
This error names only the randomly selected peer, not the full peer table. During recovery it often surfaces little-known cloud-hosted nodes that were discovered earlier and saved to the database. That does not mean the node ignores seed peers.
3. Blockchain sync (strict)
The loader sync path uses
peers.list()with the default filter:CONNECTEDpeers only.If no peer is currently
CONNECTEDwith a usable height, sync finishes with:In that situation the node is not "disconnected from the network" in the sense of having no peer records. It simply has zero active peers suitable for block download.
Typical outage timeline
CONNECTEDpeers becomeDISCONNECTED.CONNECTEDand sync resumes.The gap between "internet is back" and "node is syncing again" can be several minutes (or longer if remote peers are still unreachable), because recovery depends on a successful round-trip to a peer that becomes
CONNECTED, not merely on local connectivity.Operator expectations
Failed to find enough good peersmeans no currently active peers, not that the peer table was wiped.Possible improvements (for discussion)
warnwhen noCONNECTEDpeers remain for longer than N minutes.getFromRandomPeerinstead of a uniform random pick.Failed to find enough good peers.async.retryexhausts all sync attempts.Tags
nodespeer-discoverysyncreliabilityoperatorsnetwork-outageBeta Was this translation helpful? Give feedback.
All reactions