From 785f2bb76439c83b642990776af8257d9c7b5ed2 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Wed, 26 Feb 2025 18:36:46 -0500 Subject: [PATCH] Tweak the `stalled` condition, remove some unit test logs --- src/test/consensus/Consensus_test.cpp | 2 ++ src/xrpld/consensus/DisputedTx.h | 11 +++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/test/consensus/Consensus_test.cpp b/src/test/consensus/Consensus_test.cpp index 2476641514e..c4c333491c1 100644 --- a/src/test/consensus/Consensus_test.cpp +++ b/src/test/consensus/Consensus_test.cpp @@ -1184,6 +1184,7 @@ class Consensus_test : public beast::unit_test::suite auto const& lcl = peer->lastClosedLedger; BEAST_EXPECT(lcl.id() == peer->prevLedgerID()); + /* log << "Peer " << peer->id << ", lcl seq: " << lcl.seq() << ", prevProposers: " << peer->prevProposers << ", txs in lcl: " << lcl.txs().size() << ", validations: " @@ -1193,6 +1194,7 @@ class Consensus_test : public beast::unit_test::suite log << "\tLedger ID: " << id << ", #positions: " << positions.size() << std::endl; } + */ /* log << "\t" << to_string(peer->consensus.getJson(true)) << std::endl diff --git a/src/xrpld/consensus/DisputedTx.h b/src/xrpld/consensus/DisputedTx.h index 8fb320a469f..fda13f8be5a 100644 --- a/src/xrpld/consensus/DisputedTx.h +++ b/src/xrpld/consensus/DisputedTx.h @@ -97,7 +97,7 @@ class DisputedTx // We're have not reached the final avalanche state, or been there long // enough, so there's room for change. Check the times in case the state // machine is altered to allow states to loop. - if (avalancheState_ != currentCutoff.next || + if (avalancheState_ == currentCutoff.next || nextCutoff.consensusTime > currentCutoff.consensusTime || avalancheCounter_ < p.avMIN_ROUNDS) return false; @@ -118,13 +118,8 @@ class DisputedTx // Does this transaction have more than 80% agreement // Compute the percentage of nodes voting 'yes' (possibly including us) - int support = yays_ * 100; - int total = nays_ + yays_; - if (proposing) // give ourselves full weight - { - support += (ourVote_ ? 100 : 0); - ++total; - } + int const support = (yays_ + (proposing && ourVote_ ? 1 : 0)) * 100; + int total = nays_ + yays_ + (proposing ? 1 : 0); if (!total) // There are no votes, so we know nothing return false;