@@ -112,6 +112,10 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client,
112
112
case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER :
113
113
return (client -> capabilities & HSM_PERM_SIGN_WILL_FUND_OFFER ) != 0 ;
114
114
115
+ case WIRE_HSMD_CHECK_OUTPOINT :
116
+ case WIRE_HSMD_LOCK_OUTPOINT :
117
+ return (client -> capabilities & HSM_PERM_LOCK_OUTPOINT ) != 0 ;
118
+
115
119
case WIRE_HSMD_INIT :
116
120
case WIRE_HSMD_NEW_CHANNEL :
117
121
case WIRE_HSMD_CLIENT_HSMFD :
@@ -145,6 +149,8 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client,
145
149
case WIRE_HSMD_CLIENT_HSMFD_REPLY :
146
150
case WIRE_HSMD_NEW_CHANNEL_REPLY :
147
151
case WIRE_HSMD_SETUP_CHANNEL_REPLY :
152
+ case WIRE_HSMD_CHECK_OUTPOINT_REPLY :
153
+ case WIRE_HSMD_LOCK_OUTPOINT_REPLY :
148
154
case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY :
149
155
case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY :
150
156
case WIRE_HSMD_SIGN_INVOICE_REPLY :
@@ -402,6 +408,38 @@ static u8 *handle_next_funding_pubkey(struct hsmd_client *c, const u8 *msg_in)
402
408
return towire_hsmd_setup_channel_reply (NULL );
403
409
}
404
410
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
+
405
443
/*~ For almost every wallet tx we use the BIP32 seed, but not for onchain
406
444
* unilateral closes from a peer: they (may) have an output to us using a
407
445
* 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,
1931
1969
return handle_setup_channel (client , msg );
1932
1970
case WIRE_HSMD_NEXT_FUNDING_PUBKEY :
1933
1971
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 );
1934
1976
case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY :
1935
1977
return handle_get_output_scriptpubkey (client , msg );
1936
1978
case WIRE_HSMD_CHECK_FUTURE_SECRET :
@@ -2009,6 +2051,8 @@ u8 *hsmd_handle_client_message(const tal_t *ctx, struct hsmd_client *client,
2009
2051
case WIRE_HSMD_NEW_CHANNEL_REPLY :
2010
2052
case WIRE_HSMD_SETUP_CHANNEL_REPLY :
2011
2053
case WIRE_HSMD_NEXT_FUNDING_PUBKEY_REPLY :
2054
+ case WIRE_HSMD_CHECK_OUTPOINT_REPLY :
2055
+ case WIRE_HSMD_LOCK_OUTPOINT_REPLY :
2012
2056
case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY :
2013
2057
case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY :
2014
2058
case WIRE_HSMD_SIGN_INVOICE_REPLY :
@@ -2051,6 +2095,8 @@ u8 *hsmd_init(struct secret hsm_secret,
2051
2095
WIRE_HSMD_SIGN_ANCHORSPEND ,
2052
2096
WIRE_HSMD_SIGN_HTLC_TX_MINGLE ,
2053
2097
WIRE_HSMD_SIGN_SPLICE_TX ,
2098
+ WIRE_HSMD_CHECK_OUTPOINT ,
2099
+ WIRE_HSMD_LOCK_OUTPOINT ,
2054
2100
};
2055
2101
2056
2102
/*~ Don't swap this. */
0 commit comments