Skip to content

Commit aaa2033

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 88173ae commit aaa2033

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
@@ -3737,8 +3737,7 @@ static void splice_accepter(struct peer *peer, const u8 *inmsg)
37373737

37383738
if (!pubkey_eq(&peer->splicing->remote_funding_pubkey,
37393739
&peer->channel->funding_pubkey[REMOTE]))
3740-
peer_failed_warn(peer->pps, &peer->channel_id,
3741-
"Splice doesnt support changing pubkeys");
3740+
status_info("Splice peer is rotating funding pubkey");
37423741

37433742
if (funding_feerate_perkw < peer->feerate_min)
37443743
peer_failed_warn(peer->pps, &peer->channel_id,
@@ -3851,7 +3850,7 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
38513850
{
38523851
struct channel_id channel_id;
38533852
size_t input_index;
3854-
const u8 *wit_script;
3853+
const u8 *wit_script, *new_wit_script;
38553854
u8 *outmsg;
38563855
struct interactivetx_context *ictx;
38573856
struct bitcoin_tx *prev_tx;
@@ -3876,8 +3875,7 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
38763875

38773876
if (!pubkey_eq(&peer->splicing->remote_funding_pubkey,
38783877
&peer->channel->funding_pubkey[REMOTE]))
3879-
peer_failed_warn(peer->pps, &peer->channel_id,
3880-
"Splice[ACK] doesnt support changing pubkeys");
3878+
status_info("Splice[ACK] peer is rotating funding pubkey");
38813879

38823880
peer->splicing->received_tx_complete = false;
38833881
peer->splicing->sent_tx_complete = false;
@@ -3898,6 +3896,9 @@ static void splice_initiator(struct peer *peer, const u8 *inmsg)
38983896
wit_script = bitcoin_redeem_2of2(tmpctx,
38993897
&peer->channel->funding_pubkey[LOCAL],
39003898
&peer->channel->funding_pubkey[REMOTE]);
3899+
new_wit_script = bitcoin_redeem_2of2(tmpctx,
3900+
&peer->channel->funding_pubkey[LOCAL],
3901+
&peer->splicing->remote_funding_pubkey);
39013902

39023903
input_index = ictx->desired_psbt->num_inputs;
39033904

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

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

0 commit comments

Comments
 (0)