Skip to content

Commit

Permalink
Move faulty assert (#4533)
Browse files Browse the repository at this point in the history
This assert was put in the wrong place, but it only triggers if shards
are configured. This change moves the assert to the right place and
updates it to ensure correctness.

The assert could be hit after the server downloads some shards. It may
be necessary to restart after the shards are downloaded.

Note that asserts are normally checked only in debug builds, so release
packages should not be affected.

Introduced in: #4319 (66627b2)
  • Loading branch information
ximinez authored May 23, 2023
1 parent ce997a6 commit 32f8ae1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ripple/nodestore/impl/Shard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,6 @@ Shard::finalize(bool writeSQLite, std::optional<uint256> const& referenceHash)

ledger->stateMap().setLedgerSeq(ledgerSeq);
ledger->txMap().setLedgerSeq(ledgerSeq);
assert(
ledger->info().seq < XRP_LEDGER_EARLIEST_FEES ||
ledger->read(keylet::fees()));
ledger->setImmutable();
if (!ledger->stateMap().fetchRoot(
SHAMapHash{ledger->info().accountHash}, nullptr))
Expand All @@ -713,6 +710,11 @@ Shard::finalize(bool writeSQLite, std::optional<uint256> const& referenceHash)
if (writeSQLite && !storeSQLite(ledger))
return fail("failed storing to SQLite databases");

assert(
ledger->info().seq == ledgerSeq &&
(ledger->info().seq < XRP_LEDGER_EARLIEST_FEES ||
ledger->read(keylet::fees())));

hash = ledger->info().parentHash;
next = std::move(ledger);

Expand Down

0 comments on commit 32f8ae1

Please sign in to comment.