From 011c14b45adf0bd299e62a2dc1bf60462d6690a8 Mon Sep 17 00:00:00 2001 From: Scott Schurr Date: Wed, 1 Nov 2023 12:38:45 -0700 Subject: [PATCH] [TEST] Even more logging --- src/ripple/app/misc/impl/AmendmentTable.cpp | 42 +++++++++++++++++++-- src/ripple/consensus/Consensus.h | 4 -- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/ripple/app/misc/impl/AmendmentTable.cpp b/src/ripple/app/misc/impl/AmendmentTable.cpp index 36423c7509b..09c098b7ef7 100644 --- a/src/ripple/app/misc/impl/AmendmentTable.cpp +++ b/src/ripple/app/misc/impl/AmendmentTable.cpp @@ -162,7 +162,8 @@ class TrustedVotes // from that validator. So flapping due to that validator being off // line will happen less frequently than every 24 hours. using namespace std::chrono_literals; - static constexpr NetClock::duration expiresAfter = 24h; + // !!!! DEBUG !!!! + static constexpr NetClock::duration expiresAfter = 2h; // 24h; // Walk all validations and replace previous votes from trusted // validators with these newest votes. @@ -177,11 +178,32 @@ class TrustedVotes { auto const& choices = val->getFieldV256(sfAmendments); iter->second.upVotes.assign(choices.begin(), choices.end()); + + JLOG(journal.debug()) + << "!#! Saving " << choices.size() + << " upvotes from validator " + << toBase58( + TokenType::NodePublic, val->getSignerPublic()) + << ". Votes expire in " + << std::chrono::duration_cast( + iter->second.timeout - closeTime) + .count() + << " seconds."; } else { // This validator does not upVote any amendments right now. iter->second.upVotes.clear(); + + JLOG(journal.debug()) + << "!#! Saving 0 upvotes from validator " + << toBase58( + TokenType::NodePublic, val->getSignerPublic()) + << ". Votes expire in " + << std::chrono::duration_cast( + iter->second.timeout - closeTime) + .count() + << " seconds."; } } } @@ -192,6 +214,16 @@ class TrustedVotes recordedVotes_.end(), [&closeTime, &journal](decltype(recordedVotes_)::value_type& votes) { + JLOG(journal.debug()) + << "!#! Validator " + << toBase58(TokenType::NodePublic, votes.first) << " has " + << votes.second.upVotes.size() + << " saved upvotes. Upvotes expire in " + << std::chrono::duration_cast( + votes.second.timeout - closeTime) + .count() + << " seconds"; + if (closeTime > votes.second.timeout) { JLOG(journal.debug()) @@ -295,7 +327,7 @@ class AmendmentSet } bool - passes(uint256 const& amendment) const + passes(uint256 const& amendment, beast::Journal const& journal) const { auto const& it = votes_.find(amendment); @@ -311,6 +343,10 @@ class AmendmentSet trustedValidations_ == 1) return it->second >= threshold_; + JLOG(journal.debug()) + << "!#! Amendment " << to_string(amendment) << " got " << it->second + << " votes and needs more than " << threshold_; + return it->second > threshold_; } @@ -813,7 +849,7 @@ AmendmentTableImpl::doVoting( { NetClock::time_point majorityTime = {}; - bool const hasValMajority = vote->passes(entry.first); + bool const hasValMajority = vote->passes(entry.first, j_); { auto const it = majorityAmendments.find(entry.first); diff --git a/src/ripple/consensus/Consensus.h b/src/ripple/consensus/Consensus.h index 10d1a276f7c..3111976d3cc 100644 --- a/src/ripple/consensus/Consensus.h +++ b/src/ripple/consensus/Consensus.h @@ -1322,10 +1322,6 @@ Consensus::phaseOpen() adaptor_.parms(), j_); - JLOG(j_.debug()) - << "!#! Consensus::phaseOpen::shouldCloseLedger: " - << shouldClose; - if (shouldClose) { closeLedger();