mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 05:55:51 +00:00
If we don't have a ledger we should have, make sure we mark it missing so the
fetch engine will work on it.
This commit is contained in:
@@ -107,7 +107,13 @@ public:
|
||||
return mCurrentLedger;
|
||||
if (mFinalizedLedger && (mFinalizedLedger->getLedgerSeq() == index))
|
||||
return mFinalizedLedger;
|
||||
return mLedgerHistory.getLedgerBySeq(index);
|
||||
Ledger::pointer ret = mLedgerHistory.getLedgerBySeq(index);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
boost::recursive_mutex::scoped_lock ml(mLock);
|
||||
mCompleteLedgers.clearValue(index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Ledger::pointer getLedgerByHash(const uint256& hash)
|
||||
|
||||
@@ -107,6 +107,23 @@ uint32 NetworkOPs::getLedgerID(const uint256& hash)
|
||||
return lrLedger ? lrLedger->getLedgerSeq() : 0;
|
||||
}
|
||||
|
||||
Ledger::pointer NetworkOPs::getLedgerBySeq(const uint32 seq)
|
||||
{
|
||||
Ledger::pointer ret;
|
||||
|
||||
ret = mLedgerMaster->getLedgerBySeq(seq);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!haveLedger(seq))
|
||||
return ret;
|
||||
|
||||
// We should have this ledger but we don't
|
||||
cLog(lsWARNING) << "We should have ledger " << seq;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32 NetworkOPs::getCurrentLedgerID()
|
||||
{
|
||||
return mLedgerMaster->getCurrentLedger()->getLedgerSeq();
|
||||
@@ -683,7 +700,8 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
|
||||
cLog(lsTRACE) << "NetworkOPs::checkLastClosedLedger";
|
||||
|
||||
Ledger::pointer ourClosed = mLedgerMaster->getClosedLedger();
|
||||
if(!ourClosed) return(false);
|
||||
if(!ourClosed)
|
||||
return false;
|
||||
|
||||
uint256 closedLedger = ourClosed->getHash();
|
||||
uint256 prevClosedLedger = ourClosed->getParentHash();
|
||||
@@ -714,11 +732,7 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
|
||||
|
||||
BOOST_FOREACH(Peer::ref it, peerList)
|
||||
{
|
||||
if (!it)
|
||||
{
|
||||
cLog(lsDEBUG) << "NOP::CS Dead pointer in peer list";
|
||||
}
|
||||
else if (it->isConnected())
|
||||
if (it && it->isConnected())
|
||||
{
|
||||
uint256 peerLedger = it->getClosedLedgerHash();
|
||||
if (peerLedger.isNonZero())
|
||||
@@ -738,13 +752,14 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
|
||||
for (boost::unordered_map<uint256, ValidationCount>::iterator it = ledgers.begin(), end = ledgers.end();
|
||||
it != end; ++it)
|
||||
{
|
||||
cLog(lsTRACE) << "L: " << it->first << " t=" << it->second.trustedValidations <<
|
||||
cLog(lsDEBUG) << "L: " << it->first << " t=" << it->second.trustedValidations <<
|
||||
", n=" << it->second.nodesUsing;
|
||||
|
||||
// Temporary logging to make sure tiebreaking isn't broken
|
||||
if (it->second.trustedValidations > 0)
|
||||
cLog(lsTRACE) << " TieBreakTV: " << it->second.highValidation;
|
||||
else tLog(it->second.nodesUsing > 0, lsTRACE) << " TieBreakNU: " << it->second.highNodeUsing;
|
||||
else
|
||||
tLog(it->second.nodesUsing > 0, lsTRACE) << " TieBreakNU: " << it->second.highNodeUsing;
|
||||
|
||||
if (it->second > bestVC)
|
||||
{
|
||||
@@ -775,7 +790,7 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
|
||||
}
|
||||
|
||||
cLog(lsWARNING) << "We are not running on the consensus ledger";
|
||||
cLog(lsINFO) << "Our LCL " << ourClosed->getHash();
|
||||
cLog(lsINFO) << "Our LCL: " << ourClosed->getJson(0);
|
||||
cLog(lsINFO) << "Net LCL " << closedLedger;
|
||||
if ((mMode == omTRACKING) || (mMode == omFULL))
|
||||
setMode(omCONNECTED);
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
Ledger::ref getValidatedLedger() { return mLedgerMaster->getValidatedLedger(); }
|
||||
Ledger::ref getCurrentLedger() { return mLedgerMaster->getCurrentLedger(); }
|
||||
Ledger::pointer getLedgerByHash(const uint256& hash) { return mLedgerMaster->getLedgerByHash(hash); }
|
||||
Ledger::pointer getLedgerBySeq(const uint32 seq) { return mLedgerMaster->getLedgerBySeq(seq); }
|
||||
Ledger::pointer getLedgerBySeq(const uint32 seq);
|
||||
|
||||
uint256 getClosedLedgerHash() { return mLedgerMaster->getClosedLedger()->getHash(); }
|
||||
|
||||
|
||||
@@ -1453,7 +1453,7 @@ Json::Value RPCHandler::doTx(Json::Value jvRequest)
|
||||
|
||||
if (txn->getLedger() != 0)
|
||||
{
|
||||
Ledger::pointer lgr = theApp->getLedgerMaster().getLedgerBySeq(txn->getLedger());
|
||||
Ledger::pointer lgr = theApp->getOPs().getLedgerBySeq(txn->getLedger());
|
||||
if (lgr)
|
||||
{
|
||||
bool okay = false;
|
||||
@@ -1538,7 +1538,7 @@ Json::Value RPCHandler::doLedger(Json::Value jvRequest)
|
||||
else if (strLedger.size() > 12)
|
||||
ledger = theApp->getLedgerMaster().getLedgerByHash(uint256(strLedger));
|
||||
else
|
||||
ledger = theApp->getLedgerMaster().getLedgerBySeq(jvRequest["ledger"].asUInt());
|
||||
ledger = theApp->getOPs().getLedgerBySeq(jvRequest["ledger"].asUInt());
|
||||
|
||||
if (!ledger)
|
||||
return rpcError(rpcLGR_NOT_FOUND);
|
||||
|
||||
Reference in New Issue
Block a user