#33904 rest: add interface for gettxspendingprevout rpc
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #33904 rest: add interface for gettxspendingprevout rpc | Ready | 0 | Positive | 185 + 110 tests | |||
|
|
|
|
| |||
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 a new REST endpoint at `/rest/txspendingprevout/` exposing the functionality of the `gettxspendingprevout` RPC. The endpoint accepts up to 15 outpoints in the URI path and queries the mempool and optional `txospenderindex` for transactions spending those outputs. It supports JSON output along with `mempool_only` and `return_spending_tx` query parameters.
Problem: Clients relying on Bitcoin Core's unauthenticated REST interface cannot query which transactions spend given outputs, forcing them to use the JSON-RPC interface even when the node has `txospenderindex` enabled.
Evidence of importance:
- PR description: 'This is part of https://github.com/bitcoin/bitcoin/issues/33808, and now that sstone’s PR https://github.com/bitcoin/bitcoin/pull/24539 is merged, I added `mempool_only` and `return_spending_tx` as query params.'
Risk of a mistake: medium (rpc_api). A flaw in URI parsing or index query handling could cause unhandled exceptions or denial of service on the HTTP server.
Changed since the previous assessment: Added an explicit include of util/expected.h in src/rest.cpp to satisfy include-what-you-use (IWYU) requirements.
Reviewability
Ready
Nothing known that would invalidate a review now.
Agreement
Positive
support without stated reasons, no open objection (sedited)
Thread notes: First read of the PR. Dropped items from the previous assessment regarding maflcko's style requests and sedited's inline suggestions as they are code style nits or inline questions without named harms; recorded sedited's Concept ACK as support.
Objections, suggestions, and questions: none recorded.
Support:
- sedited (member) (Concept ACK, 2026-05-10): (no reason given) [not substantive]
Participants:
- fanquake (member, neutral, 1 statements 2026-03-16 to 2026-03-16): notified that dependency PR #24539 was merged
- sedited (member, support, 5 statements 2026-05-10 to 2026-08-27): Concept ACK; suggested aligning with RPC helpers, limiting query outpoints, and adding test coverage
- maflcko (member, neutral, 2 statements 2026-05-11 to 2026-05-11): requested code style formatting and removing @ mentions from PR description
Files
111 lines under test/bench/ci.
- src/rest.cpp +142/-0
- test/functional/interface_rest.py +110/-1
- doc/REST-interface.md +43/-0
Card
The short text the ranking pass compares across PRs.
This PR adds a REST endpoint at /rest/txspendingprevout/ mirroring the gettxspendingprevout RPC method. Users and external applications querying Bitcoin Core over the unauthenticated REST interface previously lacked an endpoint to check whether outpoints were spent in the mempool or confirmed via txospenderindex without falling back to JSON-RPC. The endpoint supports batch lookups of up to 15 outpoints in JSON format with optional mempool_only and return_spending_tx query parameters. It addresses feature parity requested in issue 33808.
Data
thread read through 2026-09-01 (17 statements), head b2387b5e82
Discussion read under schema 1 rules: suggestions and questions may be missing, and an objection may combine several harms (schema history).
labels: RPC/REST/ZMQ
Categories
RPC / REST / ZMQ
P3 · new feature
Exposes existing gettxspendingprevout functionality over the unauthenticated REST interface. As noted in the description, this addresses a gap where 'clients relying on Bitcoin Core\'s unauthenticated REST interface cannot query which transactions spend given outputs, forcing them to use the JSON-RPC interface'.
Membership: Has the RPC/REST/ZMQ label and adds a new `/rest/txspendingprevout/` endpoint in src/rest.cpp.
Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 0