From 6b144f874952f731dafe1e7c063f02432557f649 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 29 Aug 2012 17:33:37 -0700 Subject: [PATCH] Quick fix to the bug causing crashes. Will rethink shortly to make sure it's correct, but this should be adequate. --- src/NetworkOPs.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index 509f6baa9e..eb0aedc5c6 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -615,21 +615,6 @@ bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash, uint return false; NewcoinAddress naPeerPublic = NewcoinAddress::createNodePublic(strCopy(pubKey)); - LedgerProposal::pointer proposal = - boost::make_shared(mConsensus->getLCL(), proposeSeq, proposeHash, closeTime, naPeerPublic); - if (!proposal->checkSign(signature)) - { // Note that if the LCL is different, the signature check will fail - Log(lsWARNING) << "Ledger proposal fails signature check"; - return false; - } - - // Is this node on our UNL? - if (!theApp->getUNL().nodeInUNL(proposal->peekPublic())) - { - Log(lsINFO) << "Untrusted proposal: " << naPeerPublic.humanNodePublic() << " " << - proposal->getCurrentHash().GetHex(); - return true; - } if ((!mConsensus) && (mMode == omFULL)) { @@ -644,10 +629,26 @@ bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash, uint } if (!mConsensus) { - Log(lsWARNING) << "Received proposal when full but not during consensus window"; + Log(lsINFO) << "Received proposal outside consensus window"; + return (mMode != omFULL); + } + + LedgerProposal::pointer proposal = + boost::make_shared(mConsensus->getLCL(), proposeSeq, proposeHash, closeTime, naPeerPublic); + if (!proposal->checkSign(signature)) + { // Note that if the LCL is different, the signature check will fail + Log(lsWARNING) << "Ledger proposal fails signature check"; return false; } + // Is this node on our UNL? + if (!theApp->getUNL().nodeInUNL(proposal->peekPublic())) + { + Log(lsINFO) << "Untrusted proposal: " << naPeerPublic.humanNodePublic() << " " << + proposal->getCurrentHash().GetHex(); + return true; + } + return mConsensus->peerPosition(proposal); }