Skip to content

Commit

Permalink
Tweak the stalled condition, remove some unit test logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ximinez committed Feb 26, 2025
1 parent 729821c commit 979462f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/test/consensus/Consensus_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: "
Expand All @@ -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
Expand Down
12 changes: 3 additions & 9 deletions src/xrpld/consensus/DisputedTx.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +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 ||
nextCutoff.consensusTime > currentCutoff.consensusTime ||
if (nextCutoff.consensusTime > currentCutoff.consensusTime ||
avalancheCounter_ < p.avMIN_ROUNDS)
return false;

Expand All @@ -118,13 +117,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;
Expand Down

0 comments on commit 979462f

Please sign in to comment.