From 7ea9ad9de765d7c8d215202821a4e07b748b9d8c Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sat, 9 Feb 2013 15:41:21 -0800 Subject: [PATCH] Improve consensus logging. --- src/cpp/ripple/LedgerConsensus.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/cpp/ripple/LedgerConsensus.cpp b/src/cpp/ripple/LedgerConsensus.cpp index 6f0dc8405..e29868aef 100644 --- a/src/cpp/ripple/LedgerConsensus.cpp +++ b/src/cpp/ripple/LedgerConsensus.cpp @@ -244,9 +244,12 @@ bool LCTransaction::updateVote(int percentTime, bool proposing) weight = (mYays * 100 + (mOurVote ? 100 : 0)) / (mNays + mYays + 1); // To prevent avalanche stalls, we increase the needed weight slightly over time - if (percentTime < AV_MID_CONSENSUS_TIME) newPosition = weight > AV_INIT_CONSENSUS_PCT; - else if (percentTime < AV_LATE_CONSENSUS_TIME) newPosition = weight > AV_MID_CONSENSUS_PCT; - else newPosition = weight > AV_LATE_CONSENSUS_PCT; + if (percentTime < AV_MID_CONSENSUS_TIME) + newPosition = weight > AV_INIT_CONSENSUS_PCT; + else if (percentTime < AV_LATE_CONSENSUS_TIME) + newPosition = weight > AV_MID_CONSENSUS_PCT; + else + newPosition = weight > AV_LATE_CONSENSUS_PCT; } else // don't let us outweigh a proposing node, just recognize consensus { @@ -256,14 +259,15 @@ bool LCTransaction::updateVote(int percentTime, bool proposing) if (newPosition == mOurVote) { -#ifdef LC_DEBUG - cLog(lsTRACE) << "No change (" << (mOurVote ? "YES" : "NO") << ") : weight " - << weight << ", percent " << percentTime; -#endif + cLog(lsINFO) << + "No change (" << (mOurVote ? "YES" : "NO") << ") : weight " << weight << ", percent " << percentTime; + cLog(lsDEBUG) << getJson(); return false; } + mOurVote = newPosition; cLog(lsDEBUG) << "We now vote " << (mOurVote ? "YES" : "NO") << " on " << mTransactionID; + cLog(lsDEBUG) << getJson(); return true; }