Skip to content

Commit 9796491

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 b019103 commit 9796491

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
@@ -276,6 +276,13 @@ static struct wally_psbt *anchor_psbt(const tal_t *ctx,
276276
psbt_append_output(psbt,
277277
scriptpubkey_p2tr(tmpctx, &final_key),
278278
change);
279+
280+
/* And finally, if we're running on an elements chain we also need to
281+
* add an explicit fee output. */
282+
if (is_elements(chainparams)) {
283+
psbt_elements_normalize_fees(psbt);
284+
}
285+
279286
return psbt;
280287
}
281288

lightningd/onchain_control.c

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

1142+
if (chainparams->is_elements) {
1143+
psbt_elements_normalize_fees(psbt);
1144+
}
1145+
11421146
/* Now, get HSM to sign off. */
11431147
msg = towire_hsmd_sign_htlc_tx_mingle(NULL,
11441148
&channel->peer->id,

0 commit comments

Comments
 (0)