mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
elements: consolidate fee outputs into a single fee output
In the case that you've got more than one fee output already on a psbt, we consolidate them into a single fee output (the first)
This commit is contained in:
parent
9771273c4d
commit
165d039f6c
@ -327,7 +327,13 @@ void psbt_elements_normalize_fees(struct wally_psbt *psbt)
|
||||
for (size_t i = 0; i < psbt->num_outputs; i++) {
|
||||
asset = wally_tx_output_get_amount(&psbt->tx->outputs[i]);
|
||||
if (elements_wtx_output_is_fee(psbt->tx, i)) {
|
||||
fee_output_idx = i;
|
||||
if (fee_output_idx == psbt->num_outputs) {
|
||||
fee_output_idx = i;
|
||||
continue;
|
||||
}
|
||||
/* We already have at least one fee output,
|
||||
* remove this one */
|
||||
psbt_rm_output(psbt, i--);
|
||||
continue;
|
||||
}
|
||||
if (!amount_asset_is_main(&asset))
|
||||
|
Loading…
Reference in New Issue
Block a user