From 9d412718df6b40960cd1bd5dda44c9a5ac331f18 Mon Sep 17 00:00:00 2001 From: niftynei Date: Thu, 8 Oct 2020 17:26:04 -0500 Subject: [PATCH] psbt: save the index of the change on the 'parent' Note that for removals, the index will be on the original; for additions, the index will be on the new. Yes this is implicit. --- common/psbt_open.c | 1 + common/psbt_open.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/common/psbt_open.c b/common/psbt_open.c index 9137ccf86..4b65f431f 100644 --- a/common/psbt_open.c +++ b/common/psbt_open.c @@ -219,6 +219,7 @@ void psbt_sort_by_serial_id(struct wally_psbt *psbt) struct type##_set a; \ a.type = from->type##s[index]; \ a.tx_##type = from->tx->type##s[index]; \ + a.idx = index; \ tal_arr_expand(&add_to, a); \ } while (0) diff --git a/common/psbt_open.h b/common/psbt_open.h index 3fb20865d..08efd46df 100644 --- a/common/psbt_open.h +++ b/common/psbt_open.h @@ -19,11 +19,15 @@ struct wally_map; struct input_set { struct wally_tx_input tx_input; struct wally_psbt_input input; + /* index on PSBT of this input */ + size_t idx; }; struct output_set { struct wally_tx_output tx_output; struct wally_psbt_output output; + /* index on PSBT of this output */ + size_t idx; }; struct psbt_changeset {