fix: Check the transaction map in the parallel ledger walk

`Ledger::walkLedger` returned `walkMapParallel`'s result directly when asked for a
parallel walk, which skipped the transaction map walk and the missing-node logging
that follow. `Application::loadOldLedger` is the only parallel caller, so `--load`,
`--ledger`, `--ledgerfile` and `--replay` never checked a ledger's transaction map.

The parallel result is now held in a local and combined with both maps' missing-node
lists at the end. The early return could not simply be deleted: `walkMapParallel`
reports a worker that cannot read the node store through its return value alone, so
dropping the boolean would lose that answer while `missingNodes1` stays empty.

This is an operational change for anyone using `--load` as a recovery step. A ledger
whose transaction map is missing a node is now refused at startup rather than
accepted. Refusing is the intent: the walk exists to decide whether every node of
both maps is available, and until now it answered for only one of them.

Two gtests in `src/tests/libxrpl/ledger/WalkLedger.cpp` build a ledger whose state
map is complete and whose transaction map holds only its root, then check that both
the parallel and the serial walk report it incomplete. A second case checks that a
ledger with two complete maps passes on both paths. The first fails against the
early return.
This commit is contained in:
Bart
2026-09-23 14:35:12 +02:00
parent 05c5998634
commit 201d5bb6ff
3 changed files with 203 additions and 6 deletions

View File

@@ -330,6 +330,18 @@ public:
void
updateSkipList();
/**
* Check that every node of both of this ledger's maps is available.
*
* The function walks the state map and then the transaction map, and logs
* what it could not read.
*
* @param j The journal to log missing nodes to.
* @param parallel Walk the state map on several threads. The transaction
* map is always walked on one thread.
* @return True when both maps are complete. False when either map is
* missing a node.
*/
bool
walkLedger(beast::Journal j, bool parallel = false) const;