From e2393646dc4ca3fb656e0ce167ec2a92c6cc0dbd Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Fri, 18 Sep 2026 13:15:31 +0700 Subject: [PATCH] fix(app): construct overlay before START_UP ledger load LOAD restart called overlay() from tryAdvance/getFetchPack while overlay_ was still created later in setup. Keep beginConsensus after the ledger exists. --- src/xrpld/app/main/Application.cpp | 39 ++++++++++++++++-------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 874c8ca110..43a5b87838 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -1362,6 +1362,27 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline) Pathfinder::initPathTable(); + // Overlay must exist before START_UP ledger load. LOAD -> switchLCL -> + // checkAccept can tryAdvance/getFetchPack and call overlay() while + // validators are still unloaded (quorum 0). Object only; start() is later. + // VFALCO NOTE Unfortunately, in stand-alone mode some code still + // foolishly calls overlay(). When this is fixed we can + // move the instantiation inside a conditional: + // + // if (!config_.standalone()) + overlay_ = overlayFactory_ + ? overlayFactory_(*this) + : make_Overlay( + *this, + setup_Overlay(*config_), + *serverHandler_, + *m_resourceManager, + *m_resolver, + get_io_service(), + *config_, + m_collectorManager->collector()); + add(*overlay_); // add to PropertyStream + auto const startUp = config_->START_UP; JLOG(m_journal.debug()) << "startUp: " << startUp; if (startUp == Config::FRESH) @@ -1490,24 +1511,6 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline) // //---------------------------------------------------------------------- - // VFALCO NOTE Unfortunately, in stand-alone mode some code still - // foolishly calls overlay(). When this is fixed we can - // move the instantiation inside a conditional: - // - // if (!config_.standalone()) - overlay_ = overlayFactory_ - ? overlayFactory_(*this) - : make_Overlay( - *this, - setup_Overlay(*config_), - *serverHandler_, - *m_resourceManager, - *m_resolver, - get_io_service(), - *config_, - m_collectorManager->collector()); - add(*overlay_); // add to PropertyStream - // start first consensus round if (!m_networkOPs->beginConsensus( m_ledgerMaster->getClosedLedger()->info().hash, {}))