Coin Brief ENDE

rippled adds the missing null checks to two RPC handlers, matching the guards in its other account handlers

The XRP Ledger's reference server, rippled, merged pull request 7827 on 5 November. The change adds a safety check to two RPC handlers that walk an account's directory of ledger objects: the one behind noripple_check, which reports trust line settings, and the one behind gateway_balances, which totals what an issuing account owes. The pull request was opened by the contributor with the handle SAY-5, adds 18 lines across two files and closes issue 7510.

Both handlers receive each directory entry, called an SLE, through a callback. Until now the two callbacks used that entry without checking whether it was null. Other handlers that iterate account directories in the same way, those for account_lines, account_channels and account_offers, already guard against this with a block that marks the null case as unreachable and returns early. The new code adds the same guard to the two handlers that lacked it, so all directory-iteration callbacks now behave consistently.

The pull request is explicit that this is defensive. In normal operation the read always returns a valid entry, and the author writes that the null path cannot be reached through the existing RPC unit tests without a corrupted ledger. For that reason the new lines are excluded from coverage measurement, in the same way as the equivalent guard in the account_lines code. The existing test suites for NoRippleCheck and GatewayBalances exercise the normal path and continue to pass. The author ticked none of the boxes for public API, libxrpl or peer protocol changes.

rippled adds the missing null checks to two RPC handlers, matching the guards in its other account handlers
rippled adds the missing null checks to two RPC handlers, matching the guards in its other account handlers — Coin Brief

What it means

Node operators will see no change in behaviour on a healthy ledger. The fix narrows the ways a corrupted or unexpected ledger state could crash a server answering public RPC queries, which matters most for operators who expose those commands to clients.

Primary source
rippled pull request #7827
https://github.com/XRPLF/rippled/pull/7827
Written by Victoria Shinder.