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())
|
if (mAcquired.find(hash) != mAcquired.end())
|
||||||
return; // we already have this map
|
return; // we already have this map
|
||||||
|
|
||||||
if (mOurPosition && (hash != mOurPosition->getCurrentHash()))
|
if (mOurPosition && (!mOurPosition->isBowOut()) && (hash != mOurPosition->getCurrentHash()))
|
||||||
{ // this could create disputed transactions
|
{ // this could create disputed transactions
|
||||||
boost::unordered_map<uint256, SHAMap::pointer>::iterator it2 = mAcquired.find(mOurPosition->getCurrentHash());
|
boost::unordered_map<uint256, SHAMap::pointer>::iterator it2 = mAcquired.find(mOurPosition->getCurrentHash());
|
||||||
if (it2 != mAcquired.end())
|
if (it2 != mAcquired.end())
|
||||||
@@ -674,12 +674,14 @@ void LedgerConsensus::updateOurPositions()
|
|||||||
{
|
{
|
||||||
uint256 newHash = ourPosition->getHash();
|
uint256 newHash = ourPosition->getHash();
|
||||||
Log(lsINFO) << "Position change: CTime " << closeTime << ", tx " << newHash;
|
Log(lsINFO) << "Position change: CTime " << closeTime << ", tx " << newHash;
|
||||||
mOurPosition->changePosition(newHash, closeTime);
|
if (mOurPosition->changePosition(newHash, closeTime))
|
||||||
|
{
|
||||||
if (mProposing)
|
if (mProposing)
|
||||||
propose();
|
propose();
|
||||||
mapComplete(newHash, ourPosition, false);
|
mapComplete(newHash, ourPosition, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool LedgerConsensus::haveConsensus()
|
bool LedgerConsensus::haveConsensus()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,17 +54,20 @@ bool LedgerProposal::checkSign(const std::string& signature, const uint256& sign
|
|||||||
return mPublicKey.verifyNodePublic(signingHash, signature);
|
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;
|
mCurrentHash = newPosition;
|
||||||
mCloseTime = closeTime;
|
mCloseTime = closeTime;
|
||||||
mTime = boost::posix_time::second_clock::universal_time();
|
mTime = boost::posix_time::second_clock::universal_time();
|
||||||
++mProposeSeq;
|
++mProposeSeq;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerProposal::bowOut()
|
void LedgerProposal::bowOut()
|
||||||
{
|
{
|
||||||
mCurrentHash = uint256();
|
|
||||||
mTime = boost::posix_time::second_clock::universal_time();
|
mTime = boost::posix_time::second_clock::universal_time();
|
||||||
mProposeSeq = seqLeave;
|
mProposeSeq = seqLeave;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,11 +59,12 @@ public:
|
|||||||
void setSignature(const std::string& signature) { mSignature = signature; }
|
void setSignature(const std::string& signature) { mSignature = signature; }
|
||||||
bool hasSignature() { return !mSignature.empty(); }
|
bool hasSignature() { return !mSignature.empty(); }
|
||||||
bool isPrevLedger(const uint256& pl) { return mPreviousLedger == pl; }
|
bool isPrevLedger(const uint256& pl) { return mPreviousLedger == pl; }
|
||||||
|
bool isBowOut() { return mProposeSeq == seqLeave; }
|
||||||
|
|
||||||
const boost::posix_time::ptime getCreateTime() { return mTime; }
|
const boost::posix_time::ptime getCreateTime() { return mTime; }
|
||||||
bool isStale(boost::posix_time::ptime cutoff) { return mTime <= cutoff; }
|
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();
|
void bowOut();
|
||||||
Json::Value getJson() const;
|
Json::Value getJson() const;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user