Skip to content

Commit

Permalink
[FOLD] Add additional logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bachase committed Nov 7, 2017
1 parent e11279f commit 5496ac4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
21 changes: 17 additions & 4 deletions src/ripple/app/consensus/RCLConsensus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,16 @@ RCLConsensus::Adaptor::validate(RCLCxLedger const& ledger, bool proposing)
app_.overlay().send(val);
}

void
RCLConsensus::Adaptor::onModeChange(
ConsensusMode before,
ConsensusMode after)
{
JLOG(j_.info()) << "Consensus mode change before=" << to_string(before)
<< ", after=" << to_string(after);
mode_ = after;
}

Json::Value
RCLConsensus::getJson(bool full) const
{
Expand Down Expand Up @@ -950,14 +960,18 @@ RCLConsensus::Adaptor::preStartRound(RCLCxLedger const & prevLgr)
prevLgr.seq() >= app_.getMaxDisallowedLedger() &&
!app_.getOPs().isAmendmentBlocked();

const bool synced = app_.getOPs().getOperatingMode() == NetworkOPs::omFULL;

if (validating_)
{
JLOG(j_.info()) << "Entering consensus process, validating";
JLOG(j_.info()) << "Entering consensus process, validating, synced="
<< (synced ? "yes" : "no");
}
else
{
// Otherwise we just want to monitor the validation process.
JLOG(j_.info()) << "Entering consensus process, watching";
JLOG(j_.info()) << "Entering consensus process, watching, synced="
<< (synced ? "yes" : "no");
}

// Notify inbound ledgers that we are starting a new round
Expand All @@ -967,8 +981,7 @@ RCLConsensus::Adaptor::preStartRound(RCLCxLedger const & prevLgr)
parms_.useRoundedCloseTime = prevLgr.ledger_->rules().enabled(fix1528);

// propose only if we're in sync with the network (and validating)
return validating_ &&
(app_.getOPs().getOperatingMode() == NetworkOPs::omFULL);
return validating_ && synced;
}

void
Expand Down
12 changes: 8 additions & 4 deletions src/ripple/app/consensus/RCLConsensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,15 @@ class RCLConsensus
RCLCxLedger const& ledger,
ConsensusMode mode);

/** Notified of change in consensus mode
@param before The prior consensus mode
@param after The new consensus mode
*/
void
onModeChange(ConsensusMode before, ConsensusMode after)
{
mode_ = after;
}
onModeChange(
ConsensusMode before,
ConsensusMode after);

/** Close the open ledger and return initial consensus position.
Expand Down

0 comments on commit 5496ac4

Please sign in to comment.