Skip to content

Commit 8575847

Browse files
committed
splice: Enable remote funding key rotation
Allows our peer to change their funding pub key during a splice. Changelog-Changed: Support added for peers that wish to rotate their funding pubkey during a splice.
1 parent 39a65ba commit 8575847

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

channeld/channeld.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3640,11 +3640,6 @@ static void splice_accepter(struct peer *peer, const u8 *inmsg)
36403640
peer_failed_warn(peer->pps, &peer->channel_id,
36413641
"Splice internal error: mismatched channelid");
36423642

3643-
if (!pubkey_eq(&splice_remote_pubkey,
3644-
&peer->channel->funding_pubkey[REMOTE]))
3645-
peer_failed_warn(peer->pps, &peer->channel_id,
3646-
"Splice doesnt support changing pubkeys");
3647-
36483643
if (funding_feerate_perkw < peer->feerate_min)
36493644
peer_failed_warn(peer->pps, &peer->channel_id,
36503645
"Splice feerate_perkw is too low");
@@ -3755,7 +3750,7 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
37553750
{
37563751
struct channel_id channel_id;
37573752
size_t input_index;
3758-
const u8 *wit_script;
3753+
const u8 *wit_script, *new_wit_script;
37593754
u8 *outmsg;
37603755
struct interactivetx_context *ictx;
37613756
struct bitcoin_tx *prev_tx;
@@ -3779,11 +3774,6 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
37793774
peer_failed_warn(peer->pps, &peer->channel_id,
37803775
"Splice[ACK] internal error: mismatched channelid");
37813776

3782-
if (!pubkey_eq(&splice_remote_pubkey,
3783-
&peer->channel->funding_pubkey[REMOTE]))
3784-
peer_failed_warn(peer->pps, &peer->channel_id,
3785-
"Splice[ACK] doesnt support changing pubkeys");
3786-
37873777
peer->splicing->received_tx_complete = false;
37883778
peer->splicing->sent_tx_complete = false;
37893779
peer->splice_state->locked_ready[LOCAL] = false;
@@ -3803,6 +3793,9 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
38033793
wit_script = bitcoin_redeem_2of2(tmpctx,
38043794
&peer->channel->funding_pubkey[LOCAL],
38053795
&peer->channel->funding_pubkey[REMOTE]);
3796+
new_wit_script = bitcoin_redeem_2of2(tmpctx,
3797+
&peer->channel->funding_pubkey[LOCAL],
3798+
&peer->splicing->remote_funding_pubkey);
38063799

38073800
input_index = ictx->desired_psbt->num_inputs;
38083801

@@ -3840,7 +3833,7 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
38403833
* funding keys using the higher of the two `generation` fields.
38413834
*/
38423835
psbt_append_output(ictx->desired_psbt,
3843-
scriptpubkey_p2wsh(ictx->desired_psbt, wit_script),
3836+
scriptpubkey_p2wsh(ictx->desired_psbt, new_wit_script),
38443837
calc_balance(peer));
38453838

38463839
psbt_add_serials(ictx->desired_psbt, ictx->our_role);

0 commit comments

Comments
 (0)