mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +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())
|
||||
{
|
||||
auto const ledger = getLedgerByHash (it);
|
||||
assert(ledger);
|
||||
if (!ledger || ledger->info().seq < seq)
|
||||
m_ledgers_by_hash.del (it, false);
|
||||
}
|
||||
|
||||
@@ -504,14 +504,13 @@ LedgerMaster::getFetchPack (LedgerIndex missingIndex,
|
||||
{
|
||||
auto haveHash = getLedgerHashForHistory(
|
||||
missingIndex + 1, reason);
|
||||
if (!haveHash)
|
||||
if (!haveHash || haveHash->isZero())
|
||||
{
|
||||
JLOG (m_journal.error()) <<
|
||||
"No hash for fetch pack. Missing Index " <<
|
||||
std::to_string(missingIndex);
|
||||
return;
|
||||
}
|
||||
assert(haveHash->isNonZero());
|
||||
|
||||
// Select target Peer based on highest score. The score is randomized
|
||||
// but biased in favor of Peers with low latency.
|
||||
|
||||
Reference in New Issue
Block a user