Skip to content

Commit 6f46a48

Browse files
committed
chore: Add fee output on elements for anchor spends and resends
The fee output is mandatory in `elements`-based chains, for the homomorphic amount commitment to work out. These transactions were missing that output.
1 parent 876e07c commit 6f46a48

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lightningd/anchorspend.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ static struct wally_psbt *anchor_psbt(const tal_t *ctx,
288288
psbt_append_output(psbt,
289289
scriptpubkey_p2tr(tmpctx, &final_key),
290290
change);
291+
292+
/* And finally, if we're running on an elements chain we also need to
293+
* add an explicit fee output. */
294+
if (is_elements(chainparams)) {
295+
psbt_elements_normalize_fees(psbt);
296+
}
297+
291298
return psbt;
292299
}
293300

lightningd/onchain_control.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,10 @@ static bool consider_onchain_htlc_tx_rebroadcast(struct channel *channel,
11411141
return true;
11421142
}
11431143

1144+
if (chainparams->is_elements) {
1145+
psbt_elements_normalize_fees(psbt);
1146+
}
1147+
11441148
/* Now, get HSM to sign off. */
11451149
hsm_utxos = utxos_to_hsm_utxos(tmpctx, utxos);
11461150
msg = towire_hsmd_sign_htlc_tx_mingle(NULL,

0 commit comments

Comments
 (0)