diff --git a/src/LedgerConsensus.cpp b/src/LedgerConsensus.cpp index f7fa15de13..71dca921ca 100644 --- a/src/LedgerConsensus.cpp +++ b/src/LedgerConsensus.cpp @@ -411,7 +411,7 @@ void LedgerConsensus::mapComplete(const uint256& hash, SHAMap::ref map, bool acq if (mAcquired.find(hash) != mAcquired.end()) return; // we already have this map - if (mOurPosition && (hash != mOurPosition->getCurrentHash())) + if (mOurPosition && (!mOurPosition->isBowOut()) && (hash != mOurPosition->getCurrentHash())) { // this could create disputed transactions boost::unordered_map::iterator it2 = mAcquired.find(mOurPosition->getCurrentHash()); if (it2 != mAcquired.end()) @@ -674,10 +674,12 @@ void LedgerConsensus::updateOurPositions() { uint256 newHash = ourPosition->getHash(); Log(lsINFO) << "Position change: CTime " << closeTime << ", tx " << newHash; - mOurPosition->changePosition(newHash, closeTime); - if (mProposing) - propose(); - mapComplete(newHash, ourPosition, false); + if (mOurPosition->changePosition(newHash, closeTime)) + { + if (mProposing) + propose(); + mapComplete(newHash, ourPosition, false); + } } } diff --git a/src/LedgerProposal.cpp b/src/LedgerProposal.cpp index 5840c10372..a334a612f7 100644 --- a/src/LedgerProposal.cpp +++ b/src/LedgerProposal.cpp @@ -54,17 +54,20 @@ bool LedgerProposal::checkSign(const std::string& signature, const uint256& sign return mPublicKey.verifyNodePublic(signingHash, signature); } -void LedgerProposal::changePosition(const uint256& newPosition, uint32 closeTime) +bool LedgerProposal::changePosition(const uint256& newPosition, uint32 closeTime) { + if (mProposeSeq == seqLeave) + return false; + mCurrentHash = newPosition; mCloseTime = closeTime; mTime = boost::posix_time::second_clock::universal_time(); ++mProposeSeq; + return true; } void LedgerProposal::bowOut() { - mCurrentHash = uint256(); mTime = boost::posix_time::second_clock::universal_time(); mProposeSeq = seqLeave; } diff --git a/src/LedgerProposal.h b/src/LedgerProposal.h index adaa557719..fb7df34309 100644 --- a/src/LedgerProposal.h +++ b/src/LedgerProposal.h @@ -59,11 +59,12 @@ public: void setSignature(const std::string& signature) { mSignature = signature; } bool hasSignature() { return !mSignature.empty(); } bool isPrevLedger(const uint256& pl) { return mPreviousLedger == pl; } + bool isBowOut() { return mProposeSeq == seqLeave; } const boost::posix_time::ptime getCreateTime() { return mTime; } bool isStale(boost::posix_time::ptime cutoff) { return mTime <= cutoff; } - void changePosition(const uint256& newPosition, uint32 newCloseTime); + bool changePosition(const uint256& newPosition, uint32 newCloseTime); void bowOut(); Json::Value getJson() const; };