@@ -112,6 +112,10 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client,
112112 case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER :
113113 return (client -> capabilities & HSM_PERM_SIGN_WILL_FUND_OFFER ) != 0 ;
114114
115+ case WIRE_HSMD_CHECK_OUTPOINT :
116+ case WIRE_HSMD_LOCK_OUTPOINT :
117+ return (client -> capabilities & HSM_PERM_LOCK_OUTPOINT ) != 0 ;
118+
115119 case WIRE_HSMD_INIT :
116120 case WIRE_HSMD_NEW_CHANNEL :
117121 case WIRE_HSMD_CLIENT_HSMFD :
@@ -145,6 +149,8 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client,
145149 case WIRE_HSMD_CLIENT_HSMFD_REPLY :
146150 case WIRE_HSMD_NEW_CHANNEL_REPLY :
147151 case WIRE_HSMD_SETUP_CHANNEL_REPLY :
152+ case WIRE_HSMD_CHECK_OUTPOINT_REPLY :
153+ case WIRE_HSMD_LOCK_OUTPOINT_REPLY :
148154 case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY :
149155 case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY :
150156 case WIRE_HSMD_SIGN_INVOICE_REPLY :
@@ -402,6 +408,38 @@ static u8 *handle_next_funding_pubkey(struct hsmd_client *c, const u8 *msg_in)
402408 return towire_hsmd_setup_channel_reply (NULL );
403409}
404410
411+ /* ~This stub implementation is overriden by fully validating signers
412+ * to ensure they are caught up when outpoints are freshly buried */
413+ static u8 * handle_check_outpoint (struct hsmd_client * c , const u8 * msg_in )
414+ {
415+ struct bitcoin_txid funding_txid ;
416+ u16 funding_txout ;
417+ bool is_buried ;
418+
419+ if (!fromwire_hsmd_check_outpoint (msg_in , & funding_txid , & funding_txout ))
420+ return hsmd_status_malformed_request (c , msg_in );
421+
422+ /* This stub always approves */
423+ is_buried = true;
424+
425+ return towire_hsmd_check_outpoint_reply (NULL , is_buried );
426+ }
427+
428+ /* ~This stub implementation is overriden by fully validating signers to
429+ * change their funding/splice state to locked */
430+ static u8 * handle_lock_outpoint (struct hsmd_client * c , const u8 * msg_in )
431+ {
432+ struct bitcoin_txid funding_txid ;
433+ u16 funding_txout ;
434+
435+ if (!fromwire_hsmd_lock_outpoint (msg_in , & funding_txid , & funding_txout ))
436+ return hsmd_status_malformed_request (c , msg_in );
437+
438+ /* Stub implementation */
439+
440+ return towire_hsmd_lock_outpoint_reply (NULL );
441+ }
442+
405443/*~ For almost every wallet tx we use the BIP32 seed, but not for onchain
406444 * unilateral closes from a peer: they (may) have an output to us using a
407445 * public key based on the channel basepoints. It's a bit spammy to spend
@@ -1931,6 +1969,10 @@ u8 *hsmd_handle_client_message(const tal_t *ctx, struct hsmd_client *client,
19311969 return handle_setup_channel (client , msg );
19321970 case WIRE_HSMD_NEXT_FUNDING_PUBKEY :
19331971 return handle_next_funding_pubkey (client , msg );
1972+ case WIRE_HSMD_CHECK_OUTPOINT :
1973+ return handle_check_outpoint (client , msg );
1974+ case WIRE_HSMD_LOCK_OUTPOINT :
1975+ return handle_lock_outpoint (client , msg );
19341976 case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY :
19351977 return handle_get_output_scriptpubkey (client , msg );
19361978 case WIRE_HSMD_CHECK_FUTURE_SECRET :
@@ -2009,6 +2051,8 @@ u8 *hsmd_handle_client_message(const tal_t *ctx, struct hsmd_client *client,
20092051 case WIRE_HSMD_NEW_CHANNEL_REPLY :
20102052 case WIRE_HSMD_SETUP_CHANNEL_REPLY :
20112053 case WIRE_HSMD_NEXT_FUNDING_PUBKEY_REPLY :
2054+ case WIRE_HSMD_CHECK_OUTPOINT_REPLY :
2055+ case WIRE_HSMD_LOCK_OUTPOINT_REPLY :
20122056 case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY :
20132057 case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY :
20142058 case WIRE_HSMD_SIGN_INVOICE_REPLY :
@@ -2051,6 +2095,8 @@ u8 *hsmd_init(struct secret hsm_secret,
20512095 WIRE_HSMD_SIGN_ANCHORSPEND ,
20522096 WIRE_HSMD_SIGN_HTLC_TX_MINGLE ,
20532097 WIRE_HSMD_SIGN_SPLICE_TX ,
2098+ WIRE_HSMD_CHECK_OUTPOINT ,
2099+ WIRE_HSMD_LOCK_OUTPOINT ,
20542100 };
20552101
20562102 /*~ Don't swap this. */
0 commit comments