diff --git a/common/hsm_version.h b/common/hsm_version.h index 8b6c54bdf..e894974ce 100644 --- a/common/hsm_version.h +++ b/common/hsm_version.h @@ -33,6 +33,7 @@ * v6 with hsm_secret struct cleanup: 06c56396fe42f4f47911d7f865dd0004d264fc1348f89547743755b6b33fec90 * v6 with hsm_secret_type TLV: 7bb5deb2367482feb084d304ee14b2373d42910ad56484fbf47614dbb3d4cb74 * v6 with bip86_base in TLV: 6bb6e6ee256f22a6fb41856c90feebde3065a9074e79a46731e453a932be83f0 + * v6 with hsmd_sign_local_htlc_tx removed: 0e28ca3699196cf9d26d38f8f621d1bf68c76cf5e2cdc1f4157a6937b02dc2f6 */ #define HSM_MIN_VERSION 5 #define HSM_MAX_VERSION 6 diff --git a/hsmd/hsmd.c b/hsmd/hsmd.c index dfe61fc1b..739a148bd 100644 --- a/hsmd/hsmd.c +++ b/hsmd/hsmd.c @@ -794,7 +794,6 @@ static struct io_plan *handle_client(struct io_conn *conn, struct client *c) case WIRE_HSMD_SIGN_ANY_CANNOUNCEMENT_REQ: case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REQ: case WIRE_HSMD_CUPDATE_SIG_REQ: - case WIRE_HSMD_SIGN_LOCAL_HTLC_TX: case WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US: case WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US: case WIRE_HSMD_CHECK_PUBKEY: diff --git a/hsmd/hsmd_wire.csv b/hsmd/hsmd_wire.csv index 7336feef4..d3ee517b8 100644 --- a/hsmd/hsmd_wire.csv +++ b/hsmd/hsmd_wire.csv @@ -299,20 +299,13 @@ msgdata,hsmd_sign_remote_htlc_to_us,wscript_len,u16, msgdata,hsmd_sign_remote_htlc_to_us,wscript,u8,wscript_len msgdata,hsmd_sign_remote_htlc_to_us,option_anchor_outputs,bool, +# channeld asks HSM to sign penalty, for watchtower code. msgtype,hsmd_sign_penalty_to_us,14 msgdata,hsmd_sign_penalty_to_us,revocation_secret,secret, msgdata,hsmd_sign_penalty_to_us,tx,bitcoin_tx, msgdata,hsmd_sign_penalty_to_us,wscript_len,u16, msgdata,hsmd_sign_penalty_to_us,wscript,u8,wscript_len -# Onchaind asks HSM to sign a local HTLC success or HTLC timeout tx. -msgtype,hsmd_sign_local_htlc_tx,16 -msgdata,hsmd_sign_local_htlc_tx,commit_num,u64, -msgdata,hsmd_sign_local_htlc_tx,tx,bitcoin_tx, -msgdata,hsmd_sign_local_htlc_tx,wscript_len,u16, -msgdata,hsmd_sign_local_htlc_tx,wscript,u8,wscript_len -msgdata,hsmd_sign_local_htlc_tx,option_anchor_outputs,bool, - # Openingd/channeld asks HSM to sign the other sides' commitment tx. msgtype,hsmd_sign_remote_commitment_tx,19 msgdata,hsmd_sign_remote_commitment_tx,tx,bitcoin_tx, diff --git a/hsmd/libhsmd.c b/hsmd/libhsmd.c index c98f13c54..f8d35a044 100644 --- a/hsmd/libhsmd.c +++ b/hsmd/libhsmd.c @@ -110,7 +110,6 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client, case WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US: case WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US: case WIRE_HSMD_SIGN_PENALTY_TO_US: - case WIRE_HSMD_SIGN_LOCAL_HTLC_TX: return (client->capabilities & HSM_PERM_SIGN_ONCHAIN_TX) != 0; case WIRE_HSMD_GET_PER_COMMITMENT_POINT: @@ -1559,25 +1558,7 @@ static u8 *do_sign_local_htlc_tx(struct hsmd_client *c, return towire_hsmd_sign_tx_reply(NULL, &sig); } -/*~ Called from onchaind (deprecated) */ -static u8 *handle_sign_local_htlc_tx(struct hsmd_client *c, const u8 *msg_in) -{ - u64 commit_num; - struct bitcoin_tx *tx; - u8 *wscript; - bool option_anchor_outputs; - - if (!fromwire_hsmd_sign_local_htlc_tx(tmpctx, msg_in, - &commit_num, &tx, &wscript, - &option_anchor_outputs)) - return hsmd_status_malformed_request(c, msg_in); - - return do_sign_local_htlc_tx(c, msg_in, 0, &c->id, c->dbid, - commit_num, tx, wscript, - option_anchor_outputs); -} - -/*~ This is the same function, but lightningd calling it */ +/*~ lightningd asks us to sign our HTLC transaction. */ static u8 *handle_sign_any_local_htlc_tx(struct hsmd_client *c, const u8 *msg_in) { u64 commit_num; @@ -1752,7 +1733,7 @@ static u8 *do_sign_penalty_to_us(struct hsmd_client *c, SIGHASH_ALL); } -/*~ Called from onchaind (deprecated) */ +/*~ Called from channeld: used by watchtower code. */ static u8 *handle_sign_penalty_to_us(struct hsmd_client *c, const u8 *msg_in) { struct secret revocation_secret; @@ -2287,8 +2268,6 @@ u8 *hsmd_handle_client_message(const tal_t *ctx, struct hsmd_client *client, return handle_sign_mutual_close_tx(client, msg); case WIRE_HSMD_SIGN_SPLICE_TX: return handle_sign_splice_tx(client, msg); - case WIRE_HSMD_SIGN_LOCAL_HTLC_TX: - return handle_sign_local_htlc_tx(client, msg); case WIRE_HSMD_SIGN_REMOTE_HTLC_TX: return handle_sign_remote_htlc_tx(client, msg); case WIRE_HSMD_SIGN_REMOTE_COMMITMENT_TX: diff --git a/onchaind/test/run-grind_feerate-bug.c b/onchaind/test/run-grind_feerate-bug.c index e57aca2a4..a77627bcd 100644 --- a/onchaind/test/run-grind_feerate-bug.c +++ b/onchaind/test/run-grind_feerate-bug.c @@ -222,12 +222,6 @@ void towire_wallet_tx_type(u8 **pptr UNNEEDED, const enum wallet_tx_type type UN { fprintf(stderr, "towire_wallet_tx_type called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ -/* Stubs which do get called. */ -u8 *towire_hsmd_sign_local_htlc_tx(const tal_t *ctx UNNEEDED, u64 commit_num UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const u8 *wscript UNNEEDED, bool option_anchor_outputs UNNEEDED) -{ - return NULL; -} - u8 *wire_sync_read(const tal_t *ctx, int fd UNNEEDED) { return towire_onchaind_spend_created(ctx, true, NULL);