mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge branch 'fetch_fix'
This commit is contained in:
@@ -695,7 +695,8 @@ void LedgerConsensus::updateOurPositions()
|
||||
|
||||
for (std::map<uint32, int>::iterator it = closeTimes.begin(), end = closeTimes.end(); it != end; ++it)
|
||||
{
|
||||
cLog(lsDEBUG) << "CCTime: " << it->first << " has " << it->second << ", " << threshVote << " required";
|
||||
cLog(lsDEBUG) << "CCTime: seq" << mPreviousLedger->getLedgerSeq() + 1 << ": " <<
|
||||
it->first << " has " << it->second << ", " << threshVote << " required";
|
||||
if (it->second >= threshVote)
|
||||
{
|
||||
cLog(lsDEBUG) << "Close time consensus reached: " << it->first;
|
||||
|
||||
@@ -557,7 +557,10 @@ void LedgerMaster::checkAccept(const uint256& hash, uint32 seq)
|
||||
|
||||
Ledger::pointer ledger = mLedgerHistory.getLedgerByHash(hash);
|
||||
if (!ledger)
|
||||
{
|
||||
theApp->getMasterLedgerAcquire().findCreate(hash, seq);
|
||||
return;
|
||||
}
|
||||
mValidLedger = ledger;
|
||||
|
||||
tryPublish();
|
||||
@@ -575,6 +578,8 @@ void LedgerMaster::tryPublish()
|
||||
}
|
||||
else if (mValidLedger->getLedgerSeq() > (mPubLedger->getLedgerSeq() + MAX_LEDGER_GAP))
|
||||
{
|
||||
cLog(lsWARNING) << "Gap in validated ledger stream " << mPubLedger->getLedgerSeq() << " - " <<
|
||||
mValidLedger->getLedgerSeq() - 1;
|
||||
mPubLedger = mValidLedger;
|
||||
mPubLedgers.push_back(mValidLedger);
|
||||
}
|
||||
@@ -613,11 +618,11 @@ void LedgerMaster::tryPublish()
|
||||
{
|
||||
if (theApp->getMasterLedgerAcquire().isFailure(hash))
|
||||
{
|
||||
cLog(lsFATAL) << "Unable to acquire a recent validated ledger";
|
||||
cLog(lsWARNING) << "Unable to acquire a recent validated ledger";
|
||||
}
|
||||
else
|
||||
{
|
||||
LedgerAcquire::pointer acq = theApp->getMasterLedgerAcquire().findCreate(hash, 0);
|
||||
LedgerAcquire::pointer acq = theApp->getMasterLedgerAcquire().findCreate(hash, seq);
|
||||
if (!acq->isDone())
|
||||
{
|
||||
acq->setAccept();
|
||||
|
||||
@@ -285,6 +285,12 @@ bool LoadFeeTrack::raiseLocalFee()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoadFeeTrack::isLoaded()
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
return (raiseCount != 0) || (mLocalTxnLoadFee != lftNormalFee);
|
||||
}
|
||||
|
||||
bool LoadFeeTrack::lowerLocalFee()
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
void setRemoteFee(uint32);
|
||||
bool raiseLocalFee();
|
||||
bool lowerLocalFee();
|
||||
bool isLoaded() { return (raiseCount != 0) || (mLocalTxnLoadFee != lftNormalFee); }
|
||||
bool isLoaded();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -2004,9 +2004,21 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
|
||||
// jvResult["nodes"] = Json::Value(Json::arrayValue);
|
||||
}
|
||||
|
||||
void NetworkOPs::makeFetchPack(Job&, boost::weak_ptr<Peer> wPeer, boost::shared_ptr<ripple::TMGetObjectByHash> request,
|
||||
Ledger::pointer wantLedger, Ledger::pointer haveLedger)
|
||||
void NetworkOPs::makeFetchPack(Job&, boost::weak_ptr<Peer> wPeer,
|
||||
boost::shared_ptr<ripple::TMGetObjectByHash> request,
|
||||
Ledger::pointer wantLedger, Ledger::pointer haveLedger, uint32 uUptime)
|
||||
{
|
||||
if (upTime() > (uUptime + 1))
|
||||
{
|
||||
cLog(lsINFO) << "Fetch pack request got stale";
|
||||
return;
|
||||
}
|
||||
if (theApp->getFeeTrack().isLoaded())
|
||||
{
|
||||
cLog(lsINFO) << "Too busy to make fetch pack";
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Peer::pointer peer = wPeer.lock();
|
||||
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
void mapComplete(const uint256& hash, SHAMap::ref map);
|
||||
bool stillNeedTXSet(const uint256& hash);
|
||||
void makeFetchPack(Job&, boost::weak_ptr<Peer> peer, boost::shared_ptr<ripple::TMGetObjectByHash> request,
|
||||
Ledger::pointer wantLedger, Ledger::pointer haveLedger);
|
||||
Ledger::pointer wantLedger, Ledger::pointer haveLedger, uint32 uUptime);
|
||||
bool shouldFetchPack(uint32 seq);
|
||||
void gotFetchPack(bool progress, uint32 seq);
|
||||
void addFetchPack(const uint256& hash, boost::shared_ptr< std::vector<unsigned char> >& data);
|
||||
|
||||
@@ -1911,7 +1911,7 @@ void Peer::doFetchPack(const boost::shared_ptr<ripple::TMGetObjectByHash>& packe
|
||||
}
|
||||
theApp->getJobQueue().addJob(jtPACK, "MakeFetchPack",
|
||||
BIND_TYPE(&NetworkOPs::makeFetchPack, &theApp->getOPs(), P_1,
|
||||
boost::weak_ptr<Peer>(shared_from_this()), packet, wantLedger, haveLedger));
|
||||
boost::weak_ptr<Peer>(shared_from_this()), packet, wantLedger, haveLedger, upTime()));
|
||||
}
|
||||
|
||||
bool Peer::hasProto(int version)
|
||||
|
||||
Reference in New Issue
Block a user