From d679a7c7f26267e7ee9488791e8c4ae9f0e1ceca Mon Sep 17 00:00:00 2001 From: frstrtr Date: Mon, 27 Jul 2026 20:57:50 +0000 Subject: [PATCH] =?UTF-8?q?ltc(seeds):=20autosense=20seed=20ladder=20?= =?UTF-8?q?=E2=80=94=20staged=20addnode>DNS>fixed>embedded=20fallback=20(W?= =?UTF-8?q?IP)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/impl/ltc/coin/chain_seeds.hpp | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/impl/ltc/coin/chain_seeds.hpp b/src/impl/ltc/coin/chain_seeds.hpp index bc8e04c60..2c52c29ca 100644 --- a/src/impl/ltc/coin/chain_seeds.hpp +++ b/src/impl/ltc/coin/chain_seeds.hpp @@ -6,6 +6,7 @@ #include #include +#include #include namespace ltc { @@ -75,5 +76,54 @@ inline std::vector ltc_fixed_seeds(bool testnet) return testnet ? ltc_testnet_fixed_seeds() : ltc_mainnet_fixed_seeds(); } +// ── Seed ladder (autosense) ────────────────────────────────────────────── +// +// Ordered fallback ladder for LTC (DOGE aux rides the same ladder) P2P peer +// discovery. The node autosenses its way DOWN the ladder: it stays on the +// highest-priority rung that yields >= min_peers within settle_ms, and only +// escalates to the next rung on starvation. This lets an embedded node +// cold-start with no operator-supplied addnodes while still preferring +// explicit / DNS discovery when those are healthy. +// +// Additive-only: composes the ltc_dns_seeds() / ltc_fixed_seeds() helpers +// above. No src/core change — the running node consumes this ladder through +// the existing DnsSeeder / fixed-seed paths. + +enum class SeedRung { + ConfiguredAddnodes = 0, ///< operator --addnode / config (highest priority) + DnsSeeds, ///< ltc_dns_seeds() + FixedFallback, ///< ltc_fixed_seeds() + EmbeddedBootstrap, ///< own live-bootstrap seed host (starvation floor) +}; + +struct SeedLadderRung { + SeedRung rung; + uint32_t settle_ms; ///< grace before autosensing starvation on this rung + uint32_t min_peers; ///< peer count below which we escalate to the next rung +}; + +/// Autosense escalation ladder for LTC. DNS gets a full 60s resolve+dial +/// window (matching the fixed-seed fallback note above) before we fall to the +/// hardcoded fixed seeds; the embedded bootstrap host is only ever a floor. +inline std::vector ltc_seed_ladder() +{ + return { + {SeedRung::ConfiguredAddnodes, 5000, 1}, + {SeedRung::DnsSeeds, 60000, 3}, + {SeedRung::FixedFallback, 30000, 2}, + {SeedRung::EmbeddedBootstrap, 0, 1}, // floor: no further escalation + }; +} + +/// Embedded live-bootstrap seed host for the EmbeddedBootstrap rung. +/// TODO(seed-ladder): wire the deterministic own-seed host from the +/// live-bootstrap CI gate (must be our own seed host, NOT public mainnet). +/// Returns empty until that gate host is pinned — the ladder degrades +/// gracefully to FixedFallback in the meantime. +inline std::vector ltc_embedded_bootstrap_seeds(bool /*testnet*/) +{ + return {}; +} + } // namespace coin } // namespace ltc \ No newline at end of file