@@ -122,6 +122,7 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client,
122122 case WIRE_HSMD_SIGN_INVOICE :
123123 case WIRE_HSMD_SIGN_COMMITMENT_TX :
124124 case WIRE_HSMD_GET_CHANNEL_BASEPOINTS :
125+ case WIRE_HSMD_NEXT_FUNDING_PUBKEY :
125126 case WIRE_HSMD_DEV_MEMLEAK :
126127 case WIRE_HSMD_SIGN_MESSAGE :
127128 case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY :
@@ -162,6 +163,7 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client,
162163 case WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY :
163164 case WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY :
164165 case WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY :
166+ case WIRE_HSMD_NEXT_FUNDING_PUBKEY_REPLY :
165167 case WIRE_HSMD_DEV_MEMLEAK_REPLY :
166168 case WIRE_HSMD_SIGN_MESSAGE_REPLY :
167169 case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY :
@@ -397,6 +399,27 @@ static u8 *handle_sync_outpoint(struct hsmd_client *c, const u8 *msg_in)
397399 return towire_hsmd_setup_channel_reply (NULL );
398400}
399401
402+ /* ~Return the funding pubkey for the next splice */
403+ static u8 * handle_next_funding_pubkey (struct hsmd_client * c , const u8 * msg_in )
404+ {
405+ struct node_id peer_id ;
406+ u64 dbid ;
407+ struct bitcoin_txid funding_txid ;
408+ u32 funding_txout ;
409+ struct secret seed ;
410+ struct pubkey funding_pubkey ;
411+
412+ if (!fromwire_hsmd_next_funding_pubkey (msg_in , & peer_id , & dbid ,
413+ & funding_txid , & funding_txout ))
414+ return hsmd_status_malformed_request (c , msg_in );
415+
416+ // TODO actually rotate the funding pubkey
417+ get_channel_seed (& peer_id , dbid , & seed );
418+ derive_basepoints (& seed , & funding_pubkey , NULL , NULL , NULL );
419+
420+ return towire_hsmd_setup_channel_reply (NULL );
421+ }
422+
400423/*~ For almost every wallet tx we use the BIP32 seed, but not for onchain
401424 * unilateral closes from a peer: they (may) have an output to us using a
402425 * public key based on the channel basepoints. It's a bit spammy to spend
@@ -1926,6 +1949,8 @@ u8 *hsmd_handle_client_message(const tal_t *ctx, struct hsmd_client *client,
19261949 return handle_setup_channel (client , msg );
19271950 case WIRE_HSMD_SYNC_OUTPOINT :
19281951 return handle_sync_outpoint (client , msg );
1952+ case WIRE_HSMD_NEXT_FUNDING_PUBKEY :
1953+ return handle_next_funding_pubkey (client , msg );
19291954 case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY :
19301955 return handle_get_output_scriptpubkey (client , msg );
19311956 case WIRE_HSMD_CHECK_FUTURE_SECRET :
@@ -2004,6 +2029,7 @@ u8 *hsmd_handle_client_message(const tal_t *ctx, struct hsmd_client *client,
20042029 case WIRE_HSMD_NEW_CHANNEL_REPLY :
20052030 case WIRE_HSMD_SETUP_CHANNEL_REPLY :
20062031 case WIRE_HSMD_SYNC_OUTPOINT_REPLY :
2032+ case WIRE_HSMD_NEXT_FUNDING_PUBKEY_REPLY :
20072033 case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY :
20082034 case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY :
20092035 case WIRE_HSMD_SIGN_INVOICE_REPLY :
0 commit comments