Cleanups and bugfixes.

This commit is contained in:
JoelKatz
2012-07-16 00:47:46 -07:00
parent c9f4d5d900
commit 7e7356c155
4 changed files with 5 additions and 27 deletions

View File

@@ -198,6 +198,7 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::pointer pre
Log(lsTRACE) << "LCL:" << previousLedger->getHash().GetHex() <<", ct=" << closeTime;
mPreviousProposers = theApp->getOPs().getPreviousProposers();
mPreviousSeconds = theApp->getOPs().getPreviousSeconds();
assert(mPreviousSeconds);
mCloseResolution = ContinuousLedgerTiming::getNextLedgerTimeResolution(
previousLedger->getCloseResolution(), previousLedger->getCloseAgree(), previousLedger->getLedgerSeq() + 1);
@@ -356,12 +357,6 @@ void LedgerConsensus::statusChange(newcoin::NodeEvent event, Ledger::pointer led
Log(lsINFO) << "send status change to peer";
}
void LedgerConsensus::abort()
{
Log(lsWARNING) << "consensus aborted";
mState = lcsABORTED;
}
int LedgerConsensus::startup()
{
// create wobble ledger in case peers target transactions to it
@@ -433,7 +428,7 @@ void LedgerConsensus::timerEntry()
{
if (!mHaveCorrectLCL)
{
Log(lsINFO) << "Checking if we have the consensus ledger";
Log(lsINFO) << "Checking for consensus ledger " << mPrevLedgerHash.GetHex();
Ledger::pointer consensus = theApp->getMasterLedger().getLedgerByHash(mPrevLedgerHash);
if (consensus)
{
@@ -455,7 +450,6 @@ void LedgerConsensus::timerEntry()
case lcsESTABLISH: stateEstablish(); return;
case lcsFINISHED: stateFinished(); return;
case lcsACCEPTED: stateAccepted(); return;
case lcsABORTED: return;
}
assert(false);
}

View File

@@ -72,7 +72,6 @@ enum LCState
lcsESTABLISH, // Establishing consensus
lcsFINISHED, // We have closed on a transaction set
lcsACCEPTED, // We have accepted/validated a new last closed ledger
lcsABORTED // Abandoned
};
class LedgerConsensus : public boost::enable_shared_from_this<LedgerConsensus>
@@ -151,7 +150,6 @@ public:
TransactionAcquire::pointer getAcquiring(const uint256& hash);
void mapComplete(const uint256& hash, SHAMap::pointer map, bool acquired);
void abort();
void timerEntry();
// state handlers

View File

@@ -23,7 +23,7 @@ int ContinuousLedgerTiming::shouldClose(
assert((currentSeconds >= 0) && (currentSeconds < 600));
#if 0
Log(lsTRACE) << boost::str(boost::format("CLC::shouldClose Trans=%s, Prop: %d/%d, Secs: %d/%d") %
Log(lsTRACE) << boost::str(boost::format("CLC::shouldClose Trans=%s, Prop: %d/%d, Secs: %d (last:%d)") %
(anyTransactions ? "yes" : "no") % previousProposers % proposersClosed % currentSeconds % previousSeconds);
#endif

View File

@@ -459,12 +459,6 @@ void NetworkOPs::switchLastClosedLedger(Ledger::pointer newLedger)
Log(lsERROR) << "ABNORMAL Switching last closed ledger to " << newLedger->getHash().GetHex();
if (mConsensus)
{
mConsensus->abort();
mConsensus = boost::shared_ptr<LedgerConsensus>();
}
newLedger->setClosed();
Ledger::pointer openLedger = boost::make_shared<Ledger>(false, boost::ref(*newLedger));
mLedgerMaster->switchLedgers(newLedger, openLedger);
@@ -497,8 +491,7 @@ int NetworkOPs::beginConsensus(const uint256& networkClosed, Ledger::pointer clo
assert(closingLedger->getParentHash() == mLedgerMaster->getClosedLedger()->getHash());
// Create a consensus object to get consensus on this ledger
if (!!mConsensus)
mConsensus->abort();
assert(!mConsensus);
prevLedger->setImmutable();
mConsensus = boost::make_shared<LedgerConsensus>(
networkClosed, prevLedger, theApp->getMasterLedger().getCurrentLedger()->getCloseTimeNC());
@@ -600,14 +593,6 @@ void NetworkOPs::setMode(OperatingMode om)
if (mMode == om) return;
if ((om >= omCONNECTED) && (mMode == omDISCONNECTED))
mConnectTime = boost::posix_time::second_clock::universal_time();
if (mMode == omFULL)
{
if (mConsensus)
{
mConsensus->abort();
mConsensus = boost::shared_ptr<LedgerConsensus>();
}
}
Log l((om < mMode) ? lsWARNING : lsINFO);
if (om == omDISCONNECTED) l << "STATE->Disonnected";
else if (om == omCONNECTED) l << "STATE->Connected";
@@ -968,6 +953,7 @@ void NetworkOPs::unsubAccountTransaction(InfoSub* ispListener, const boost::unor
void NetworkOPs::newLCL(int proposers, int convergeTime, const uint256& ledgerHash)
{
assert(convergeTime);
mLastCloseProposers = proposers;
mLastCloseConvergeTime = convergeTime;
mLastCloseHash = ledgerHash;