fix(consensus): cap bootstrap ledgerMAX_CONSENSUS at 5s

Use an explicit 5s cap instead of dividing the default 15s.
5s is the sweet spot: long enough for peers to exchange proposals
and converge naturally, short enough to avoid wasted time.
Shorter values (e.g. 3.75s) cause nodes to hit reachedMax before
peers converge, cascading into slower subsequent rounds.
This commit is contained in:
Nicholas Dudfield
2026-03-10 14:30:20 +07:00
parent 503d2ebf98
commit f0dfcf6b81

View File

@@ -2940,12 +2940,16 @@ Consensus<Adaptor>::haveConsensus(
<< (ourPosition.myReveal ? "yes" : "no");
}
// During bootstrap fast start, halve ledgerMAX_CONSENSUS so the
// "alone with zero peers" establish path exits faster. All nodes
// share the same bootstrap config, so they advance in lockstep.
// During bootstrap fast start, cap ledgerMAX_CONSENSUS at 5s so the
// "alone with zero peers" establish path exits faster. 5s is the
// sweet spot: long enough for peers to exchange proposals and agree
// naturally, short enough to not waste time waiting. Shorter values
// (e.g. 3.75s) cause nodes to hit reachedMax before peers converge,
// leading to disagreement that cascades into slower subsequent rounds.
// All nodes share the same bootstrap config, so they advance in lockstep.
auto effectiveParms = adaptor_.parms();
if (bootstrapFastStart_)
effectiveParms.ledgerMAX_CONSENSUS /= 2;
effectiveParms.ledgerMAX_CONSENSUS = std::chrono::seconds{5};
// Determine if we actually have consensus or not
result_->state = checkConsensus(