Skip to content

Commit d26af91

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 4babb0f commit d26af91

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
@@ -271,6 +271,13 @@ static struct wally_psbt *anchor_psbt(const tal_t *ctx,
271271
psbt_append_output(psbt,
272272
scriptpubkey_p2tr(tmpctx, &final_key),
273273
change);
274+
275+
/* And finally, if we're running on an elements chain we also need to
276+
* add an explicit fee output. */
277+
if (is_elements(chainparams)) {
278+
psbt_elements_normalize_fees(psbt);
279+
}
280+
274281
return psbt;
275282
}
276283

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)