merge-script
1a54886b63
Merge bitcoin/bitcoin#24539 : Add a "tx output spender" index
...
0b96b9c600e0dd946fd4d0e827e7f7cbef7a571a Minimize mempool lock, sync txo spender index only when and if needed (sstone)
3d82ec5bdd019cf1c048c41fe44faa855fcb8b53 Add a "tx output spender" index (sstone)
Pull request description:
This PR adds a new "tx output spender" index, which allows users to query which tx spent a given outpoint with the `gettxspendingprevout` RPC call that was added by https://github.com/bitcoin/bitcoin/pull/24408 .
Such an index would be extremely useful for Lightning, and probably for most layer-2 protocols that rely on chains of unpublished transactions.
UPDATE: this PR is ready for review and issues have been addressed:
- using a watch-only wallet instead would not work if there is a significant number of outpoints to watch (see https://github.com/bitcoin/bitcoin/pull/24539#issuecomment-1276595646 )
- this PR does not require `-txindex` anymore
We use a composite key with 2 parts (suggested by romanz): hash(spent outpoint) and tx position, with an empty value. Average composite key size is 15 bytes.
The spending tx can optionally be returned by `gettxspendingprevout` (even it `-txindex is not set`).
ACKs for top commit:
hodlinator:
re-ACK 0b96b9c600e0dd946fd4d0e827e7f7cbef7a571a
sedited:
Re-ACK 0b96b9c600e0dd946fd4d0e827e7f7cbef7a571a
fjahr:
ACK 0b96b9c600e0dd946fd4d0e827e7f7cbef7a571a
w0xlt:
reACK 0b96b9c600e0dd946fd4d0e827e7f7cbef7a571a
Tree-SHA512: 95c2c313ef4086e7d5bf1cf1a3c7b91cfe2bb1a0dcb4c9d3aa8a6e5bfde66aaca48d85a1f1251a780523c3e4356ec8a97fe6f5c7145bc6ccb6f820b26716ae01
2026-02-20 09:27:17 +01:00
..
2026-02-09 15:55:58 -05:00
2026-02-19 16:57:54 -08:00
2026-01-22 12:39:52 +01:00
2026-02-02 19:32:14 +01:00
2025-08-07 09:27:25 +01:00
2026-01-30 11:50:17 +00:00
2026-02-19 11:41:53 +01:00
2026-01-27 13:08:50 +01:00
2026-02-06 18:15:59 -05:00
2026-02-05 13:46:14 +00:00
2026-02-13 11:11:14 +00:00
2026-02-03 11:19:01 +01:00
2026-02-02 17:22:31 +00:00
2025-10-13 12:33:23 +01:00
2026-02-20 09:27:17 +01:00
2026-02-19 11:41:34 -08:00
2026-02-09 15:55:58 -05:00
2026-02-19 17:44:52 +01:00
2026-02-20 09:27:17 +01:00
2026-02-19 13:27:29 +01:00
2026-02-02 15:21:14 +00:00
2026-02-13 08:50:50 +01:00
2026-02-20 09:27:17 +01:00
2026-01-31 10:41:50 +00:00
2026-02-19 12:41:12 -08:00
2026-02-18 16:36:13 -08:00
2026-01-29 14:38:35 +00:00
2026-01-29 14:38:35 +00:00
2026-02-06 08:37:19 +01:00
2025-07-10 11:24:40 +02:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:04:12 +01:00
2026-01-20 23:45:29 +01:00
2026-01-14 23:04:12 +01:00
2025-12-16 22:21:15 +01:00
2025-09-12 22:28:41 +02:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-05-19 16:40:33 +01:00
2025-06-03 15:13:54 +02:00
2025-06-03 15:13:57 +02:00
2025-06-03 15:13:57 +02:00
2025-06-03 19:56:55 +02:00
2026-01-21 19:40:25 +05:30
2025-06-10 15:14:24 +02:00
2026-02-13 10:52:25 +01:00
2025-06-10 15:14:24 +02:00
2025-06-10 15:14:24 +02:00
2025-12-19 16:56:02 +00:00
2025-06-10 15:14:24 +02:00
2025-12-16 22:21:15 +01:00
2025-06-10 15:14:24 +02:00
2025-10-06 19:41:35 +01:00
2025-12-16 22:21:15 +01:00
2025-06-10 15:14:24 +02:00
2025-12-16 22:21:15 +01:00
2026-01-19 20:20:13 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 11:38:07 -08:00
2026-02-17 21:40:46 +05:30
2025-12-16 22:21:15 +01:00
2026-01-14 23:04:12 +01:00
2025-06-03 15:13:57 +02:00
2026-01-14 23:04:12 +01:00
2025-09-03 11:23:30 +01:00
2026-02-02 17:22:31 +00:00
2025-11-13 09:33:36 +01:00
2025-12-16 22:21:15 +01:00
2026-02-17 09:04:36 -05:00
2026-02-20 09:27:17 +01:00
2026-02-19 22:10:41 -05:00
2026-02-19 22:10:41 -05:00
2025-12-16 22:21:15 +01:00
2026-02-09 13:32:28 +00:00
2026-01-19 12:57:16 +01:00
2025-12-16 22:21:15 +01:00
2025-05-19 16:40:33 +01:00
2026-02-02 17:22:31 +00:00
2026-02-02 18:42:44 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:04:12 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-02-13 10:52:25 +01:00
2026-02-17 12:55:26 +01:00
2026-02-17 12:55:26 +01:00
2026-02-02 17:22:31 +00:00
2025-12-16 22:21:15 +01:00
2025-11-20 11:34:21 +09:00
2025-11-20 11:34:21 +09:00
2025-12-19 16:56:02 +00:00
2025-12-16 22:21:15 +01:00
2026-02-19 12:41:12 -08:00
2026-01-30 16:17:12 -05:00
2025-12-13 13:43:24 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-02-20 09:27:17 +01:00
2025-12-16 22:21:15 +01:00
2025-06-03 15:13:57 +02:00
2025-12-16 22:21:15 +01:00
2025-10-14 16:25:52 -04:00
2025-09-30 11:06:43 -07:00
2026-02-02 17:22:31 +00:00
2026-02-02 17:22:31 +00:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 11:38:07 -08:00
2025-12-16 22:21:15 +01:00
2025-11-24 18:48:43 +01:00
2025-11-24 18:48:43 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-02-11 19:46:19 -05:00
2026-02-11 19:46:19 -05:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-02-06 18:00:18 -08:00
2026-02-13 11:17:26 +00:00
2025-10-02 12:53:55 +01:00
2026-01-14 23:04:12 +01:00
2026-01-22 10:35:14 -05:00
2026-01-23 13:25:42 +01:00
2026-01-20 23:59:41 +01:00
2026-01-20 23:59:41 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 19:39:01 +01:00
2026-01-14 19:36:14 +01:00
2025-10-02 12:53:55 +01:00
2025-10-02 12:53:55 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:04:12 +01:00
2025-11-03 14:39:50 +01:00
2026-02-11 19:46:12 -05:00
2026-02-11 19:46:12 -05:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-02-06 07:56:57 +01:00
2026-01-14 23:03:47 +01:00
2025-09-30 11:06:09 -07:00
2025-11-03 14:39:48 +01:00
2026-02-02 17:22:31 +00:00
2026-01-14 23:04:12 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-02-09 13:32:28 +00:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-05-10 03:31:30 +00:00
2026-02-02 17:55:10 +01:00
2026-02-02 17:22:31 +00:00
2025-12-21 10:24:09 +01:00
2025-11-14 01:17:38 +02:00
2026-02-07 23:01:17 +01:00
2026-02-02 17:22:31 +00:00
2026-02-02 17:22:31 +00:00
2025-12-16 22:21:15 +01:00
2026-01-20 15:30:46 +01:00
2025-12-16 22:21:15 +01:00
2026-02-08 08:23:37 +01:00
2026-01-02 16:49:23 -08:00
2026-02-09 15:55:58 -05:00
2026-02-09 15:55:58 -05:00
2026-02-09 15:55:58 -05:00
2026-01-22 21:51:13 -05:00
2025-12-18 22:38:02 +01:00
2025-12-30 12:12:26 -08:00
2025-12-16 22:21:15 +01:00
2025-11-03 14:39:48 +01:00
2025-12-16 22:21:15 +01:00
2026-02-19 22:10:41 -05:00
2026-02-19 22:10:41 -05:00
2026-02-02 17:22:31 +00:00
2025-12-12 06:49:59 -04:00
2025-12-16 22:21:15 +01:00
2025-12-19 16:56:02 +00:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00