Fixes #35339.
This hardens the experimental libbitcoinkernel C API so caller-provided invalid runtime inputs fail through documented return/status channels instead of assertions. Existing script verification status numeric values are preserved, and the new values are appended.
Summary
- Return
nullptrfor out-of-range transaction, block transaction, block spent-output, and transaction spent-output accessors. - Add script verification statuses for unsupported flag bits and out-of-range input indexes.
- Reject malformed precomputed transaction data spent-output arrays at construction.
- Document script verification failure statuses and precomputed spent-output array requirements.
- Add focused kernel API tests for the new failure behavior, including nullable status output handling.
Testing
git diff --checkcmake -B build-kernel-validation -DBUILD_KERNEL_LIB=ON -DBUILD_KERNEL_TEST=ON -DBUILD_TESTS=OFF -DBUILD_DAEMON=OFF -DBUILD_CLI=OFF -DBUILD_BITCOIN_BIN=OFF -DBUILD_TX=OFF -DBUILD_UTIL=OFF -DENABLE_WALLET=OFF -DENABLE_IPC=OFFcmake --build build-kernel-validation --target test_kernel -j $(sysctl -n hw.ncpu)build-kernel-validation/bin/test_kernel