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:
Scott Schurr
2018-02-02 13:47:26 -08:00
committed by Brad Chase
parent 531e153144
commit b07da94c31
2 changed files with 1 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -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.