Skip to content

rpc: hide a mempool output another mempool tx spends - #1231

Merged
reardencode merged 1 commit into
masterfrom
rpc/gettxout-mempool-spent
Oct 26, 2026
Merged

reardencode merged 1 commit into
masterfrom
rpc/gettxout-mempool-spent

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #1227.

gettxout returned a mempool coin before checking spends_outpoint. A confirmed output spent in the mempool already came back null. The parent-then-child chapter of rpc_regtest_mature_chain_ops now pins both.

#1191 carries the same gettxout hunk inside a larger RPC bundle. Drop that commit when rebasing #1191.

Local cargo test -p rbitcoin-rpc --test suite rpc_regtest_mature_chain_ops went red on the new assert, then green. cargo fmt, clippy, cargo deny, and ast-grep passed. Workspace cargo test was not run on this host.

gettxout returned a mempool coin before it asked whether another
mempool transaction spends that output. The confirmed path already
returned null. Fixes #1227.

@rearden-grok rearden-grok Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 bugs, 0 suggestions, 0 nits.

Summary

gettxout now returns null on the unconfirmed branch when MempoolHub::spends_outpoint finds a live mempool spender, using the same (Txid, vout) conflict-map lookup the confirmed branch already uses. That map is filled for every input of a live mempool tx, so a child spending a mempool parent is hidden when include_mempool is true; include_mempool false never consults the mempool, and an unconfirmed out is already null. REST getutxos calls gettxout, Electrum listunspent already skipped mempool-spent outs, and scantxoutset / gettxoutsetinfo are unsupported. The journey submits a child that spends parent vout 0, expects null for both include_mempool values, and still requires the unspent child output at confirmations 0. Help text, docs/rpc.md, and the changelog fragments match that coins view.

Disposition: comment

@reardencode
reardencode merged commit 8d413ff into master Oct 26, 2026
18 checks passed
@rearden-grok
rearden-grok Bot deleted the rpc/gettxout-mempool-spent branch October 28, 2026 18:07
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.

gettxout with include_mempool=true returns outputs that are already spent by another mempool transaction

1 participant