Skip to content

log: surface BTC verify backend and Esplora fallback#351

Merged
anderdc merged 2 commits into
testfrom
fix/btc-verify-backend-logging
May 20, 2026
Merged

log: surface BTC verify backend and Esplora fallback#351
anderdc merged 2 commits into
testfrom
fix/btc-verify-backend-logging

Conversation

@LandynDev
Copy link
Copy Markdown
Collaborator

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 (getrawtransaction by hash). A pruned node (our docker-compose.vali.yml default) 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 contradictory tx ... not found debug fired even when the RPC had actually errored.

(txindex=1 would fix the RPC side but is incompatible with -prune and 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.
  • Short-circuit lightweight mode straight to Esplora, skipping a no-op RPC call (and the misleading log it produced).
  • Drop the misleading tx ... not found debug — a None from RPC can mean "absent" or "RPC error" (already logged by rpc_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: clean
  • pytest tests/test_bitcoin_signing.py: 33 passed

@anderdc anderdc merged commit fd195d5 into test May 20, 2026
3 checks passed
@anderdc anderdc deleted the fix/btc-verify-backend-logging branch May 20, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants