From 004f3719a515673d51ee5ac8499629643dd2e9d0 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 28 Aug 2012 23:44:29 -0700 Subject: [PATCH] Perhaps a fix for the problem. Try to make sure there's no window in which we can receive a proposal and be unable to act on it, even if our clock is way off and there are no transactions. The basic problem is this: With no transactions and no clock synchronization, we have no way to know when to close an idle ledger. --- src/NetworkOPs.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index 32e0c61620..2f7a4fca87 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -614,12 +614,6 @@ bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash, uint if (!theApp->isNew(s.getSHA512Half())) return false; - if (!mConsensus) - { // FIXME: CLC - Log(lsWARNING) << "Received proposal when full but not during consensus window"; - return false; - } - NewcoinAddress naPeerPublic = NewcoinAddress::createNodePublic(strCopy(pubKey)); LedgerProposal::pointer proposal = boost::make_shared(mConsensus->getLCL(), proposeSeq, proposeHash, closeTime, naPeerPublic); @@ -637,6 +631,22 @@ bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash, uint return true; } + if ((!mConsensus) && (mMode == omFULL)) + { + uint256 networkClosed; + bool ledgerChange = checkLastClosedLedger(peerList, networkClosed); + if (!ledgerChange) + { + Log(lsWARNING) << "Beginning consensus due to proposal from peer"; + beginConsensus(networkClosed, theApp->getMasterLedger().getCurrentLedger()); + } + } + if (!mConsensus) + { + Log(lsWARNING) << "Received proposal when full but not during consensus window"; + return false; + } + return mConsensus->peerPosition(proposal); }