mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 15:05:53 +00:00
Emergency patch to fix ledger not closing.
Do not timeout on acquiring a transaction set if a trusted peer still proposes it. Instead, fetch more aggressively.
This commit is contained in:
@@ -347,6 +347,18 @@ void LedgerConsensus::takeInitialPosition(Ledger& initialLedger)
|
||||
propose();
|
||||
}
|
||||
|
||||
bool LedgerConsensus::stillNeedTXSet(const uint256& hash)
|
||||
{
|
||||
if (mAcquired.find(hash) != mAcquired.end())
|
||||
return false;
|
||||
BOOST_FOREACH(u160_prop_pair& it, mPeerPositions)
|
||||
{
|
||||
if (it.second->getCurrentHash() == hash)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void LedgerConsensus::createDisputes(SHAMap::ref m1, SHAMap::ref m2)
|
||||
{
|
||||
SHAMap::SHAMapDiff differences;
|
||||
|
||||
@@ -170,6 +170,7 @@ public:
|
||||
SHAMap::pointer getTransactionTree(const uint256& hash, bool doAcquire);
|
||||
TransactionAcquire::pointer getAcquiring(const uint256& hash);
|
||||
void mapComplete(const uint256& hash, SHAMap::ref map, bool acquired);
|
||||
bool stillNeedTXSet(const uint256& hash);
|
||||
void checkLCL();
|
||||
void handleLCL(const uint256& lclHash);
|
||||
|
||||
|
||||
@@ -996,6 +996,13 @@ bool NetworkOPs::hasTXSet(const boost::shared_ptr<Peer>& peer, const uint256& se
|
||||
return mConsensus->peerHasSet(peer, set, status);
|
||||
}
|
||||
|
||||
bool NetworkOPs::stillNeedTXSet(const uint256& hash)
|
||||
{
|
||||
if (!mConsensus)
|
||||
return false;
|
||||
return mConsensus->stillNeedTXSet(hash);
|
||||
}
|
||||
|
||||
void NetworkOPs::mapComplete(const uint256& hash, SHAMap::ref map)
|
||||
{
|
||||
if (haveConsensusObject())
|
||||
|
||||
@@ -259,6 +259,7 @@ public:
|
||||
SHAMap::pointer getTXMap(const uint256& hash);
|
||||
bool hasTXSet(const boost::shared_ptr<Peer>& peer, const uint256& set, ripple::TxSetStatus status);
|
||||
void mapComplete(const uint256& hash, SHAMap::ref map);
|
||||
bool stillNeedTXSet(const uint256& hash);
|
||||
|
||||
// network state machine
|
||||
void checkState(const boost::system::error_code& result);
|
||||
|
||||
@@ -29,6 +29,7 @@ TransactionAcquire::TransactionAcquire(const uint256& hash) : PeerSet(hash, TX_A
|
||||
|
||||
void TransactionAcquire::done()
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
|
||||
if (mFailed)
|
||||
{
|
||||
cLog(lsWARNING) << "Failed to acquire TX set " << mHash;
|
||||
@@ -45,14 +46,27 @@ void TransactionAcquire::done()
|
||||
|
||||
void TransactionAcquire::onTimer(bool progress)
|
||||
{
|
||||
bool aggressive = false;
|
||||
if (getTimeouts() > 10)
|
||||
{
|
||||
cLog(lsWARNING) << "Giving up on TX set " << getHash();
|
||||
cLog(lsWARNING) << "Ten timeouts on TX set " << getHash();
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
|
||||
if (theApp->getOPs().stillNeedTXSet(mHash))
|
||||
{
|
||||
cLog(lsWARNING) << "Still need it";
|
||||
mTimeouts = 0;
|
||||
aggressive = true;
|
||||
}
|
||||
}
|
||||
if (!aggressive)
|
||||
{
|
||||
mFailed = true;
|
||||
done();
|
||||
return;
|
||||
}
|
||||
if (!getPeerCount())
|
||||
}
|
||||
if (aggressive || !getPeerCount())
|
||||
{ // out of peers
|
||||
cLog(lsWARNING) << "Out of peers for TX set " << getHash();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user