Skip to content

Commit

Permalink
[TEST] Even more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
scottschurr committed Nov 1, 2023
1 parent 990c68b commit 011c14b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
42 changes: 39 additions & 3 deletions src/ripple/app/misc/impl/AmendmentTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<std::chrono::seconds>(
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<std::chrono::seconds>(
iter->second.timeout - closeTime)
.count()
<< " seconds.";
}
}
}
Expand All @@ -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<std::chrono::seconds>(
votes.second.timeout - closeTime)
.count()
<< " seconds";

if (closeTime > votes.second.timeout)
{
JLOG(journal.debug())
Expand Down Expand Up @@ -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);

Expand All @@ -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_;
}

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/ripple/consensus/Consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -1322,10 +1322,6 @@ Consensus<Adaptor>::phaseOpen()
adaptor_.parms(),
j_);

JLOG(j_.debug())
<< "!#! Consensus<Adaptor>::phaseOpen::shouldCloseLedger: "
<< shouldClose;

if (shouldClose)
{
closeLedger();
Expand Down

0 comments on commit 011c14b

Please sign in to comment.