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.
This commit is contained in:
Nicholas Dudfield
2026-09-18 13:15:31 +07:00
parent cf438abaf5
commit e2393646dc

View File

@@ -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, {}))