From 0f44af556e99c1e4abb2f7bb4ce297e65cc16fc1 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 2 Aug 2012 11:51:24 -0700 Subject: [PATCH] Better reporting of ledger jumps. --- src/LedgerConsensus.cpp | 5 ++++- src/NetworkOPs.cpp | 6 +++--- src/NetworkOPs.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/LedgerConsensus.cpp b/src/LedgerConsensus.cpp index 71a808369d..2e57baea9e 100644 --- a/src/LedgerConsensus.cpp +++ b/src/LedgerConsensus.cpp @@ -207,6 +207,7 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::pointer pre if (!mHaveCorrectLCL) { + Log(lsINFO) << "Entering consensus process without correct LCL"; mHaveCorrectLCL = mProposing = mValidating = false; mAcquiringLedger = theApp->getMasterLedgerAcquire().findCreate(prevLCLHash); std::vector peerList = theApp->getConnectionPool().getPeerVector(); @@ -216,11 +217,13 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::pointer pre } else if (mValSeed.isValid()) { + Log(lsINFO) << "Entering consensus process, validating"; mHaveCorrectLCL = mValidating = true; mProposing = theApp->getOPs().getOperatingMode() == NetworkOPs::omFULL; } else { + Log(lsINFO) << "Entering consensus process, proposing"; mHaveCorrectLCL = true; mProposing = mValidating = false; } @@ -457,7 +460,7 @@ void LedgerConsensus::timerEntry() { Log(lsINFO) << "We have acquired the consensus ledger"; if (theApp->getMasterLedger().getClosedLedger()->getHash() != mPrevLedgerHash) - theApp->getOPs().switchLastClosedLedger(consensus); + theApp->getOPs().switchLastClosedLedger(consensus, true); mPreviousLedger = consensus; mHaveCorrectLCL = true; } diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index b4f15780d5..6126462146 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -518,15 +518,15 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector& peerLis // FIXME: If this rewinds the ledger sequence, or has the same sequence, we should update the status on // any stored transactions in the invalidated ledgers. - switchLastClosedLedger(consensus); + switchLastClosedLedger(consensus, false); return true; } -void NetworkOPs::switchLastClosedLedger(Ledger::pointer newLedger) +void NetworkOPs::switchLastClosedLedger(Ledger::pointer newLedger, bool duringConsensus) { // set the newledger as our last closed ledger -- this is abnormal code - Log(lsERROR) << "ABNORMAL Switching last closed ledger to " << newLedger->getHash().GetHex(); + Log(lsERROR) << "JUMP last closed ledger to " << newLedger->getHash().GetHex(); newLedger->setClosed(); Ledger::pointer openLedger = boost::make_shared(false, boost::ref(*newLedger)); diff --git a/src/NetworkOPs.h b/src/NetworkOPs.h index 2afa07ecf6..6ecd43a87a 100644 --- a/src/NetworkOPs.h +++ b/src/NetworkOPs.h @@ -181,7 +181,7 @@ public: // network state machine void checkState(const boost::system::error_code& result); - void switchLastClosedLedger(Ledger::pointer newLedger); // Used for the "jump" case + void switchLastClosedLedger(Ledger::pointer newLedger, bool duringConsensus); // Used for the "jump" case bool checkLastClosedLedger(const std::vector&, uint256& networkClosed); int beginConsensus(const uint256& networkClosed, Ledger::pointer closingLedger); void endConsensus(bool correctLCL);