Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FOLD] Make consensus non-pointer member
Browse files Browse the repository at this point in the history
bachase committed May 18, 2017
1 parent 6a7017a commit 84ccb97
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/ripple/app/misc/NetworkOPs.cpp
Original file line number Diff line number Diff line change
@@ -198,15 +198,15 @@ class NetworkOPsImp final
, m_amendmentBlocked (false)
, m_heartbeatTimer (this)
, m_clusterTimer (this)
, mConsensus (std::make_shared<RCLConsensus>(app,
, mConsensus (app,
make_FeeVote(setup_FeeVote (app_.config().section ("voting")),
app_.logs().journal("FeeVote")),
ledgerMaster,
*m_localTX,
app.getInboundTransactions(),
stopwatch(),
validatorKeys,
app_.logs().journal("LedgerConsensus")))
app_.logs().journal("LedgerConsensus"))
, m_ledgerMaster (ledgerMaster)
, m_job_queue (job_queue)
, m_standalone (standalone)
@@ -536,7 +536,7 @@ class NetworkOPsImp final
DeadlineTimer m_clusterTimer;
JobCounter jobCounter_;

std::shared_ptr<RCLConsensus> mConsensus;
RCLConsensus mConsensus;

LedgerMaster& m_ledgerMaster;
std::shared_ptr<InboundLedger> mAcquiringLedger;
@@ -677,7 +677,7 @@ void NetworkOPsImp::processHeartbeatTimer ()
<< "Node count (" << numPeers << ") "
<< "has fallen below quorum (" << m_network_quorum << ").";
}
// We do not call mConsensus->timerEntry until there
// We do not call mConsensus.timerEntry until there
// are enough peers providing meaningful inputs to consensus
setHeartbeatTimer ();

@@ -700,7 +700,7 @@ void NetworkOPsImp::processHeartbeatTimer ()

}

mConsensus->timerEntry (app_.timeKeeper().closeTime());
mConsensus.timerEntry (app_.timeKeeper().closeTime());

setHeartbeatTimer ();
}
@@ -757,13 +757,13 @@ std::string NetworkOPsImp::strOperatingMode () const
{
if (mMode == omFULL)
{
auto const mode = mConsensus->mode();
auto const mode = mConsensus.mode();
if (mode != ConsensusMode::wrongLedger)
{
if (mode == ConsensusMode::proposing)
return "proposing";

if (mConsensus->validating())
if (mConsensus.validating())
return "validating";
}
}
@@ -1471,7 +1471,7 @@ bool NetworkOPsImp::beginConsensus (uint256 const& networkClosed)
app_.validators().onConsensusStart (
app_.getValidations().getCurrentPublicKeys ());

mConsensus->startRound (
mConsensus.startRound (
app_.timeKeeper().closeTime(),
networkClosed,
prevLedger);
@@ -1482,15 +1482,15 @@ bool NetworkOPsImp::beginConsensus (uint256 const& networkClosed)

uint256 NetworkOPsImp::getConsensusLCL ()
{
return mConsensus->prevLedgerID ();
return mConsensus.prevLedgerID ();
}

void NetworkOPsImp::processTrustedProposal (
RCLCxPeerPos peerPos,
std::shared_ptr<protocol::TMProposeSet> set,
NodeID const& node)
{
if (mConsensus->peerProposal(
if (mConsensus.peerProposal(
app_.timeKeeper().closeTime(), peerPos))
{
app_.overlay().relay(*set, peerPos.suppressionID());
@@ -1517,7 +1517,7 @@ NetworkOPsImp::mapComplete (

// We acquired it because consensus asked us to
if (fromAcquire)
mConsensus->gotTxSet (
mConsensus.gotTxSet (
app_.timeKeeper().closeTime(),
RCLTxSet{map});
}
@@ -2100,7 +2100,7 @@ bool NetworkOPsImp::recvValidation (

Json::Value NetworkOPsImp::getConsensusInfo ()
{
return mConsensus->getJson (true);
return mConsensus.getJson (true);
}

Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
@@ -2156,23 +2156,23 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
info[jss::peers] = Json::UInt (app_.overlay ().size ());

Json::Value lastClose = Json::objectValue;
lastClose[jss::proposers] = Json::UInt(mConsensus->prevProposers());
lastClose[jss::proposers] = Json::UInt(mConsensus.prevProposers());

if (human)
{
lastClose[jss::converge_time_s] =
std::chrono::duration<double>{
mConsensus->prevRoundTime()}.count();
mConsensus.prevRoundTime()}.count();
}
else
{
lastClose[jss::converge_time] =
Json::Int (mConsensus->prevRoundTime().count());
Json::Int (mConsensus.prevRoundTime().count());
}

info[jss::last_close] = lastClose;

// info[jss::consensus] = mConsensus->getJson();
// info[jss::consensus] = mConsensus.getJson();

if (admin)
info[jss::load] = m_job_queue.getJson ();
@@ -2746,7 +2746,7 @@ std::uint32_t NetworkOPsImp::acceptLedger (
// FIXME Could we improve on this and remove the need for a specialized
// API in Consensus?
beginConsensus (m_ledgerMaster.getClosedLedger()->info().hash);
mConsensus->simulate (app_.timeKeeper().closeTime(), consensusDelay);
mConsensus.simulate (app_.timeKeeper().closeTime(), consensusDelay);
return m_ledgerMaster.getCurrentLedger ()->info().seq;
}

0 comments on commit 84ccb97

Please sign in to comment.