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.
This commit is contained in:
niftynei
2020-10-08 17:26:04 -05:00
committed by Rusty Russell
parent daa55d1221
commit 9d412718df
2 changed files with 5 additions and 0 deletions

View File

@@ -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)

View File

@@ -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 {