mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix a bug triggered by a acquiring a transaction set after having bowed out
of the consensus process.
This commit is contained in:
@@ -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<uint256, SHAMap::pointer>::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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user