Skip to content

Commit 724bce9

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 fa19774 commit 724bce9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

channeld/channeld.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3735,8 +3735,7 @@ static void splice_accepter(struct peer *peer, const u8 *inmsg)
37353735

37363736
if (!pubkey_eq(&peer->splicing->remote_funding_pubkey,
37373737
&peer->channel->funding_pubkey[REMOTE]))
3738-
peer_failed_warn(peer->pps, &peer->channel_id,
3739-
"Splice doesnt support changing pubkeys");
3738+
status_info("Splice peer is rotating funding pubkey");
37403739

37413740
if (funding_feerate_perkw < peer->feerate_min)
37423741
peer_failed_warn(peer->pps, &peer->channel_id,
@@ -3848,7 +3847,7 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
38483847
{
38493848
struct channel_id channel_id;
38503849
size_t input_index;
3851-
const u8 *wit_script;
3850+
const u8 *wit_script, *new_wit_script;
38523851
u8 *outmsg;
38533852
struct interactivetx_context *ictx;
38543853
struct bitcoin_tx *prev_tx;
@@ -3873,8 +3872,7 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
38733872

38743873
if (!pubkey_eq(&peer->splicing->remote_funding_pubkey,
38753874
&peer->channel->funding_pubkey[REMOTE]))
3876-
peer_failed_warn(peer->pps, &peer->channel_id,
3877-
"Splice[ACK] doesnt support changing pubkeys");
3875+
status_info("Splice[ACK] peer is rotating funding pubkey");
38783876

38793877
peer->splicing->received_tx_complete = false;
38803878
peer->splicing->sent_tx_complete = false;
@@ -3895,6 +3893,9 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
38953893
wit_script = bitcoin_redeem_2of2(tmpctx,
38963894
&peer->channel->funding_pubkey[LOCAL],
38973895
&peer->channel->funding_pubkey[REMOTE]);
3896+
new_wit_script = bitcoin_redeem_2of2(tmpctx,
3897+
&peer->channel->funding_pubkey[LOCAL],
3898+
&peer->splicing->remote_funding_pubkey);
38983899

38993900
input_index = ictx->desired_psbt->num_inputs;
39003901

@@ -3932,7 +3933,7 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
39323933
* funding keys using the higher of the two `generation` fields.
39333934
*/
39343935
psbt_append_output(ictx->desired_psbt,
3935-
scriptpubkey_p2wsh(ictx->desired_psbt, wit_script),
3936+
scriptpubkey_p2wsh(ictx->desired_psbt, new_wit_script),
39363937
calc_balance(peer));
39373938

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

0 commit comments

Comments
 (0)