log: surface BTC verify backend and Esplora fallback#351
Merged
Conversation
anderdc
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds debug logging so the BTC verification path makes its backend choice visible: whether a lookup was served by the local RPC node or fell back to Esplora.
Why
In node mode the validator's local bitcoind is used purely for verification reads (
getrawtransactionby hash). A pruned node (ourdocker-compose.vali.ymldefault) only resolves mempool/wallet txs, so once a tx confirms and leaves the mempool the RPC returns error -5 and we silently fall back to Esplora — on essentially every verification. That reliance was invisible in logs, and a contradictorytx ... not founddebug fired even when the RPC had actually errored.(
txindex=1would fix the RPC side but is incompatible with-pruneand implies a full ~700GB archive node — out of scope; we stay pruned and make the Esplora reliance observable instead.)Changes (logging-only, behavior-neutral)
fetch_matching_tx: log which backend served a verification (local RPC vs Esplora fallback), so reliance is greppable instead of silent.lightweightmode straight to Esplora, skipping a no-op RPC call (and the misleading log it produced).tx ... not founddebug — aNonefrom RPC can mean "absent" or "RPC error" (already logged byrpc_call); the caller now owns the fallback log.get_balance: same fallback debug + skip the no-op RPC call in lightweight mode.No control-flow or security behavior changes.
Test
ruff format/ruff check: cleanpytest tests/test_bitcoin_signing.py: 33 passed