From ee3562a9a92683578342f3282235628c0464ec09 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 1 Aug 2012 14:38:29 -0700 Subject: [PATCH] Cleanup resynch logic. --- src/LedgerConsensus.cpp | 3 +-- src/NetworkOPs.cpp | 4 +++- src/NetworkOPs.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/LedgerConsensus.cpp b/src/LedgerConsensus.cpp index c4eeab81db..699e1bd6c5 100644 --- a/src/LedgerConsensus.cpp +++ b/src/LedgerConsensus.cpp @@ -888,11 +888,10 @@ void LedgerConsensus::accept(SHAMap::pointer set) ssw.write(Log(lsTRACE).ref(), p); } #endif - // FIXME: If necessary, change state to TRACKING/FULL } void LedgerConsensus::endConsensus() { - theApp->getOPs().endConsensus(); + theApp->getOPs().endConsensus(mHaveCorrectLCL); } // vim:ts=4 diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index a802b8b08f..d1b216ebbf 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -643,7 +643,7 @@ void NetworkOPs::mapComplete(const uint256& hash, SHAMap::pointer map) mConsensus->mapComplete(hash, map, true); } -void NetworkOPs::endConsensus() +void NetworkOPs::endConsensus(bool correctLCL) { uint256 deadLedger = theApp->getMasterLedger().getClosedLedger()->getParentHash(); Log(lsTRACE) << "Ledger " << deadLedger.GetHex() << " is now dead"; @@ -655,6 +655,8 @@ void NetworkOPs::endConsensus() (*it)->cycleStatus(); } mConsensus = boost::shared_ptr(); + if (correctLCL && (mMode == omCONNECTED)) + setMode(omTRACKING); } void NetworkOPs::setMode(OperatingMode om) diff --git a/src/NetworkOPs.h b/src/NetworkOPs.h index 36c1941455..2afa07ecf6 100644 --- a/src/NetworkOPs.h +++ b/src/NetworkOPs.h @@ -184,7 +184,7 @@ public: void switchLastClosedLedger(Ledger::pointer newLedger); // Used for the "jump" case bool checkLastClosedLedger(const std::vector&, uint256& networkClosed); int beginConsensus(const uint256& networkClosed, Ledger::pointer closingLedger); - void endConsensus(); + void endConsensus(bool correctLCL); void setStateTimer(); void newLCL(int proposers, int convergeTime, const uint256& ledgerHash); int getPreviousProposers() { return mLastCloseProposers; }