From cfca708aae926b67d00ff37c5d58bb9751539c32 Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Thu, 9 Apr 2026 15:40:22 +0700 Subject: [PATCH] fix(rng): remove pendingReveals fallback from entropy output path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit shouldZeroEntropy() and sfEntropyCount no longer fall back to pendingReveals_. If entropySetMap_ is null, entropy failed — the pipeline didn't complete, and the map is the only canonical source. pendingReveals_ is now strictly an internal staging area for the commit/reveal pipeline. All final entropy decisions flow through entropySetMap_, which is the consensus-agreed set. --- .../app/consensus/ConsensusExtensions.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/xrpld/app/consensus/ConsensusExtensions.cpp b/src/xrpld/app/consensus/ConsensusExtensions.cpp index 7142d87d1..5dd7bfc04 100644 --- a/src/xrpld/app/consensus/ConsensusExtensions.cpp +++ b/src/xrpld/app/consensus/ConsensusExtensions.cpp @@ -168,19 +168,11 @@ ConsensusExtensions::hasAnyReveals() const bool ConsensusExtensions::shouldZeroEntropy() const { - if (entropyFailed_) + if (entropyFailed_ || !entropySetMap_) return true; - // Use entropySetMap_ as the canonical source when available, - // falling back to pendingReveals_ during pipeline stages - // before the map is built (e.g. ConvergingReveal timeout checks). - if (entropySetMap_) - { - auto const leafCount = entropySetMap_->leafCount(); - return leafCount == 0 || leafCount < quorumThreshold(); - } - return pendingReveals_.empty() || - pendingReveals_.size() < quorumThreshold(); + auto const leafCount = entropySetMap_->leafCount(); + return leafCount == 0 || leafCount < quorumThreshold(); } bool @@ -1191,10 +1183,7 @@ ConsensusExtensions::onPreBuild(CanonicalTXSet& retriableTxs, LedgerIndex seq) auto const entropyCount = static_cast( app_.config().standalone() ? 20 // synthetic: high enough for Hook APIs (need >= 5) - : (shouldZeroEntropy() - ? 0 - : (entropySetMap_ ? entropySetMap_->leafCount() - : pendingReveals_.size()))); + : (shouldZeroEntropy() ? 0 : entropySetMap_->leafCount())); STTx tx(ttCONSENSUS_ENTROPY, [&](auto& obj) { obj.setFieldU32(sfLedgerSequence, seq); obj.setAccountID(sfAccount, AccountID{});