From 299b31154ea78d4eb9dc5d967eba631310dc78e3 Mon Sep 17 00:00:00 2001 From: Bronek Kozicki Date: Tue, 25 Feb 2025 14:14:10 +0000 Subject: [PATCH] fix: Remove 'new parent hash' assert (#5313) This assert is known to occasionally trigger, without causing errors downstream. It is replaced with a log message. --- src/xrpld/app/misc/TxQ.h | 5 +---- src/xrpld/app/misc/detail/TxQ.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index 5b80c8fa3..a89bd21ff 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -798,13 +798,10 @@ private: */ std::optional maxSize_; -#if !NDEBUG /** - parentHash_ checks that no unexpected ledger transitions - happen, and is only checked via debug asserts. + parentHash_ used for logging only */ LedgerHash parentHash_{beast::zero}; -#endif /** Most queue operations are done under the master lock, but use this mutex for the RPC "fee" command, which isn't. diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index 7ba2cc301..d7a042ccd 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -1772,12 +1772,12 @@ TxQ::accept(Application& app, OpenView& view) // parent hash, so that transactions paying the same fee are // reordered. LedgerHash const& parentHash = view.info().parentHash; -#if !NDEBUG - auto const startingSize = byFee_.size(); - XRPL_ASSERT( - parentHash != parentHash_, "ripple::TxQ::accept : new parent hash"); - parentHash_ = parentHash; -#endif + if (parentHash == parentHash_) + JLOG(j_.warn()) << "Parent ledger hash unchanged from " << parentHash; + else + parentHash_ = parentHash; + + [[maybe_unused]] auto const startingSize = byFee_.size(); // byFee_ doesn't "own" the candidate objects inside it, so it's // perfectly safe to wipe it and start over, repopulating from // byAccount_.