mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 23:15:52 +00:00
Remove two inaccurate asserts:
The assert in LedgerHistory.cpp was incorrect since getLedgerByHash() can return a null object. The assert has been seen to fire inappropriately during online_delete. The assert in LedgerMaster.cpp was simply misguided. If a null hash were returned by getLedgerHashForHistory(), then we should not forward that hash to peers. The assert only fires in a debug build, so a release build would forward the request for a null hash to peers.
This commit is contained in:
@@ -500,7 +500,6 @@ void LedgerHistory::clearLedgerCachePrior (LedgerIndex seq)
|
|||||||
for (LedgerHash it: m_ledgers_by_hash.getKeys())
|
for (LedgerHash it: m_ledgers_by_hash.getKeys())
|
||||||
{
|
{
|
||||||
auto const ledger = getLedgerByHash (it);
|
auto const ledger = getLedgerByHash (it);
|
||||||
assert(ledger);
|
|
||||||
if (!ledger || ledger->info().seq < seq)
|
if (!ledger || ledger->info().seq < seq)
|
||||||
m_ledgers_by_hash.del (it, false);
|
m_ledgers_by_hash.del (it, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -504,14 +504,13 @@ LedgerMaster::getFetchPack (LedgerIndex missingIndex,
|
|||||||
{
|
{
|
||||||
auto haveHash = getLedgerHashForHistory(
|
auto haveHash = getLedgerHashForHistory(
|
||||||
missingIndex + 1, reason);
|
missingIndex + 1, reason);
|
||||||
if (!haveHash)
|
if (!haveHash || haveHash->isZero())
|
||||||
{
|
{
|
||||||
JLOG (m_journal.error()) <<
|
JLOG (m_journal.error()) <<
|
||||||
"No hash for fetch pack. Missing Index " <<
|
"No hash for fetch pack. Missing Index " <<
|
||||||
std::to_string(missingIndex);
|
std::to_string(missingIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(haveHash->isNonZero());
|
|
||||||
|
|
||||||
// Select target Peer based on highest score. The score is randomized
|
// Select target Peer based on highest score. The score is randomized
|
||||||
// but biased in favor of Peers with low latency.
|
// but biased in favor of Peers with low latency.
|
||||||
|
|||||||
Reference in New Issue
Block a user