Skip to content

Commit 6fd7b4c

Browse files
authored
ltc(seeds): autosense seed ladder — staged addnode>DNS>fixed>embedded fallback (WIP) (#927)
Additive scaffold in src/impl/ltc/coin/chain_seeds.hpp only: SeedRung enum, SeedLadderRung (settle_ms + min_peers escalation keys), and ltc_seed_ladder() composing the existing dns/fixed helpers. Embedded-bootstrap rung stubbed pending the live-bootstrap CI gate host. No src/core touch. DOGE aux rides the same ladder. Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
1 parent 83f7515 commit 6fd7b4c

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

src/impl/ltc/coin/chain_seeds.hpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <core/dns_seeder.hpp>
88
#include <core/netaddress.hpp>
9+
#include <cstdint>
910
#include <vector>
1011

1112
namespace ltc {
@@ -75,5 +76,54 @@ inline std::vector<NetService> ltc_fixed_seeds(bool testnet)
7576
return testnet ? ltc_testnet_fixed_seeds() : ltc_mainnet_fixed_seeds();
7677
}
7778

79+
// ── Seed ladder (autosense) ──────────────────────────────────────────────
80+
//
81+
// Ordered fallback ladder for LTC (DOGE aux rides the same ladder) P2P peer
82+
// discovery. The node autosenses its way DOWN the ladder: it stays on the
83+
// highest-priority rung that yields >= min_peers within settle_ms, and only
84+
// escalates to the next rung on starvation. This lets an embedded node
85+
// cold-start with no operator-supplied addnodes while still preferring
86+
// explicit / DNS discovery when those are healthy.
87+
//
88+
// Additive-only: composes the ltc_dns_seeds() / ltc_fixed_seeds() helpers
89+
// above. No src/core change — the running node consumes this ladder through
90+
// the existing DnsSeeder / fixed-seed paths.
91+
92+
enum class SeedRung {
93+
ConfiguredAddnodes = 0, ///< operator --addnode / config (highest priority)
94+
DnsSeeds, ///< ltc_dns_seeds()
95+
FixedFallback, ///< ltc_fixed_seeds()
96+
EmbeddedBootstrap, ///< own live-bootstrap seed host (starvation floor)
97+
};
98+
99+
struct SeedLadderRung {
100+
SeedRung rung;
101+
uint32_t settle_ms; ///< grace before autosensing starvation on this rung
102+
uint32_t min_peers; ///< peer count below which we escalate to the next rung
103+
};
104+
105+
/// Autosense escalation ladder for LTC. DNS gets a full 60s resolve+dial
106+
/// window (matching the fixed-seed fallback note above) before we fall to the
107+
/// hardcoded fixed seeds; the embedded bootstrap host is only ever a floor.
108+
inline std::vector<SeedLadderRung> ltc_seed_ladder()
109+
{
110+
return {
111+
{SeedRung::ConfiguredAddnodes, 5000, 1},
112+
{SeedRung::DnsSeeds, 60000, 3},
113+
{SeedRung::FixedFallback, 30000, 2},
114+
{SeedRung::EmbeddedBootstrap, 0, 1}, // floor: no further escalation
115+
};
116+
}
117+
118+
/// Embedded live-bootstrap seed host for the EmbeddedBootstrap rung.
119+
/// TODO(seed-ladder): wire the deterministic own-seed host from the
120+
/// live-bootstrap CI gate (must be our own seed host, NOT public mainnet).
121+
/// Returns empty until that gate host is pinned — the ladder degrades
122+
/// gracefully to FixedFallback in the meantime.
123+
inline std::vector<NetService> ltc_embedded_bootstrap_seeds(bool /*testnet*/)
124+
{
125+
return {};
126+
}
127+
78128
} // namespace coin
79129
} // namespace ltc

0 commit comments

Comments
 (0)