#33904 rest: add interface for gettxspendingprevout rpc
https://github.com/bitcoin/bitcoin/pull/33904 · · +294/-1 in 3 files, 1 commits · labels: RPC/REST/ZMQ
Goal
- Allow lightweight HTTP clients to query which transactions spend specific outpoints via REST
- Avoids requiring full JSON-RPC authentication and overhead for spending lookups
This pull request adds a `/rest/txspendingprevout` endpoint to Bitcoin Core's REST interface, mirroring the `gettxspendingprevout` RPC. It supports querying up to 15 outpoints at a time against the mempool and optional `txospenderindex`, with query parameters for `mempool_only` and `return_spending_tx`.
Problem: Lightweight or external HTTP clients consuming the REST API cannot currently query for transactions spending specific outpoints without falling back to full JSON-RPC authentication and overhead.
Category: RPC / REST / ZMQ (#16 of 52)
P3 · new feature
- P3 because it brings REST interface parity with an existing RPC for outpoint spending lookups
- Benefits external HTTP clients while having no impact on core RPC infrastructure
P3 because this adds REST parity for the existing gettxspendingprevout RPC, giving external HTTP clients direct access to mempool and txospenderindex lookups. It provides clear user value for REST consumers but does not fix a bug or affect consensus or RPC core infrastructure.
Membership: Adds a new HTTP REST endpoint in src/rest.cpp and updates interface_rest.py.
Factors: security/stability 0, bug 0, performance 0, user value 2, leverage 0
Reviewability: Ready
- Ready for review, with passing CI and previous review comments addressed
The branch is rebased on master, CI is passing, and previous review comments have been resolved.
Author status: Active; rebased promptly on 2026-09-01 after reviewer ping.
Resolved concerns:
- sedited suggested aligning the implementation with the RPC helper structures, adding a maximum limit of 15 outpoints, and testing txospenderindex in the functional test; author addressed all three.
- maflcko requested removing C-style casts and following modern formatting conventions, which author implemented.
Agreement: Positive
- Concept approval and guidance on query limits and test coverage (sedited)
- Code formatting and style review addressed (maflcko)
- All requested changes incorporated with no open objections
Positive: sedited concept ACKed and guided implementation adjustments, all addressed by author.
sedited gave Concept ACK and reviewed the endpoint's semantics and test coverage. maflcko reviewed code formatting. All feedback was incorporated and no objections remain.
- sedited: Concept ACK (2026-05-10)
- sedited requested query limits and helper alignment, author resolved them in subsequent force-pushes
- sedited pinged for rebase on 2026-08-27; author completed rebase on 2026-09-01
Review verdicts (DrahtBot): 0
- Concept ACK: sedited
Files
111 lines under test/bench/ci.
- src/rest.cpp +141/-0
- test/functional/interface_rest.py +110/-1
- doc/REST-interface.md +43/-0
Card
This PR adds a /rest/txspendingprevout endpoint to expose the gettxspendingprevout RPC functionality over the REST interface. It allows external HTTP clients to query mempool and txospenderindex spends for up to 15 outpoints at once. Reviewers sedited and maflcko offered constructive reviews regarding outpoint limits, helper code reuse, and styling, all of which the author resolved. The branch is rebased, CI is green, and the PR is ready for final review.