#36613 test: add getblockfilter test coverage for header-only blocks

ReviewabilityReviewsAgreementSize
#36613 aaron-leeb test: add getblockfilter test coverage for header-only blocksReady1Strong0 + 15 tests
  • Add test coverage for getblockfilter when querying blocks known only by header
  • Ensures the RPC returns the expected error when a block was never connected
  • Ready to review
  • Substantive support with no open objections
  • Verified test passes and exercises the error path via mutation testing (Zippo76)
  • 0 lines added or modified outside tests
  • 15 lines added or modified in tests
  • 0 lines removed in total
  • 1 files, 1 commits
RPC / REST / ZMQ#51 of 55
P4 · test coverage
  • P4 because it only closes a narrow test coverage gap for an RPC error branch
  • Exercises an untested condition without fixing an active functional bug or regression
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

Adds functional test coverage for the `getblockfilter` RPC when querying a block hash whose header is known but whose full block was never connected. The test disconnects two nodes, mines a block on one node, submits only the header to the other node via `submitheader`, and verifies that `getblockfilter` raises RPC error -5 with "Filter not found. Block was not connected to active chain."

Problem: The branch in `getblockfilter` in `src/rpc/blockchain.cpp` that handles blocks that are known by header but were never connected was completely unexercised by existing functional tests.

Evidence of importance:

  • Author notes: "This gap in test coverage was identified by a coverage report generated while exploring BIP 157/158. The branch in src/rpc/blockchain.cpp was never executed in the measured tests: https://github.com/bitcoin/bitcoin/blob/64cf455b481d36182957bdcfcae7c411a7879897/src/rpc/blockchain.cpp#L3054-L3056"

Risk of a mistake: low (tests). Only touches a functional test script; a bug could cause test flakiness or false failures in CI.

Changed since the previous assessment: No functional differences; the full diff is now provided confirming the exact test implementation in test/functional/rpc_getblockfilter.py.

Reviewability

Ready

Nothing known that would invalidate a review now.

Waiting on (from the thread read):

  • nothing

Agreement

Strong

substantive support, no open objection (Zippo76)

Thread notes: Initial record. Zippo76 tested and confirmed coverage via mutation testing; no objections raised. / Initial record. Zippo76 provided a Tested ACK with mutation testing details.

Objections, suggestions, and questions: none recorded.

Support:

  • Zippo76 (none) (Tested ACK, 2026-11-01) [both: rpc_getblockfilter.py, src/rpc/blockchain.cpp]: Verified on macOS arm64 that rpc_getblockfilter.py passes and confirmed with a mutation test in src/rpc/blockchain.cpp that the new assertion properly exercises the intended -5 error path

Participants:

  • Zippo76 (none, support, 1 statements 2026-11-01 to 2026-11-01): tested ACK with mutation testing demonstrating test coverage

Files

15 lines under test/bench/ci.

  • test/functional/rpc_getblockfilter.py +15/-0

Card

The short text the ranking pass compares across PRs.

Adds functional test coverage for the getblockfilter RPC error path when queried with a block hash for which only the header is known. It exercises the specific error branch returning error -5 indicating the block was not connected to the active chain by using submitheader across disconnected nodes. The author identified this gap via test coverage reports on BIP 157/158 code paths. No other PRs depend on this change.

Data

dossier JSON · extract JSON · model ledger, generated 2026-11-02T01:11, confidence high, input hash d3a8b8903d8670c5
thread read through 2026-11-01 (1 statements), head 64cf455b48
labels: Tests

Categories

RPC / REST / ZMQ

P4 · test coverage

Adds test coverage for an unexercised error handling branch in getblockfilter. The author identified via coverage reports that querying a block known only by header was never tested, but this is a narrow coverage gap with no reported functional bug or regression.

Membership: Changes test/functional/rpc_getblockfilter.py to test the getblockfilter RPC interface.

Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 0