bitcoin/doc/release-notes-24539.md
sstone 3d82ec5bdd
Add a "tx output spender" index
Adds an outpoint -> txid index, which can be used to find which transactions spent a given output.
We use a composite key with 2 parts (suggested by @romanz): hash(spent outpoint) and tx position, with an empty value.
To find the spending tx for a given outpoint, we do a prefix search (prefix being the hash of the provided outpoint), and for all keys that match this prefix
we load the tx at the position specified in the key and return it, along with the block hash, if does spend the provided outpoint.
To handle reorgs we just erase the keys computed from the removed block.

This index is extremely useful for Lightning and more generally for layer-2 protocols that rely on chains of unpublished transactions.
If enabled, this index will be used by `gettxspendingprevout` when it does not find a spending transaction in the mempool.
2026-02-19 11:41:53 +01:00

15 lines
676 B
Markdown

New settings
------------
- `-txospenderindex` enables the creation of a transaction output spender
index that, if present, will be scanned by `gettxspendingprevout` if a
spending transaction was not found in the mempool.
(#24539)
Updated RPCs
------------
- `gettxspendingprevout` has 2 new optional arguments: `mempool_only` and `return_spending_tx`.
If `mempool_only` is true it will limit scans to the mempool even if `txospenderindex` is available.
If `return_spending_tx` is true, the full spending tx will be returned.
In addition if `txospenderindex` is available and a confirmed spending transaction is found,
its block hash will be returned. (#24539)