mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 17:56:49 +00:00
Move the invariant-check orchestration out of ApplyContext and Transactor into a free function xrpl::checkInvariants(ApplyContext&, TER, XRPAmount, optional<reference_wrapper<InvariantCheck>>). The two previously separate traversals (one in ApplyContext driving the protocol tuple fold, one in Transactor driving the tx-specific check) are merged into a single ctx.visit walk. Per-layer try/catch inside the lambda isolates collection faults: a throw in one layer stops only that layer from visiting further entries while the other continues. A layer whose collection faulted skips its finalize phase. ApplyContext loses checkInvariants/checkInvariantsHelper/failInvariantCheck. Transactor delegates to the free runner via a private InvariantCheckAdapter that bridges visitInvariantEntry+finalizeInvariants into the InvariantCheck interface. A SkipTxInvariants::Yes/No enum makes the fee-claim-reset call site explicit about omitting the tx-specific check. Protocol checks remain duck-typed in the InvariantChecks tuple (static dispatch, no vtable on the hot path). InvariantCheck is the runtime interface used only by InvariantCheckAdapter.