From ac092c0bf96d47cd57f7a4afdd3beea9fabf1d23 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 7 Aug 2023 15:21:41 +0930 Subject: [PATCH] hsmd: fix capability check for signing splices. The nomenclature confusion mean that we were ANDING a capability with a message number (29) which always returned non-zero. We really do need a new capability which we can hand to channeld to make these splice txs. Signed-off-by: Rusty Russell --- hsmd/libhsmd.c | 2 +- hsmd/permissions.h | 1 + lightningd/channel_control.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hsmd/libhsmd.c b/hsmd/libhsmd.c index 204ae3971..1eb0e5b7c 100644 --- a/hsmd/libhsmd.c +++ b/hsmd/libhsmd.c @@ -107,7 +107,7 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client, return (client->capabilities & HSM_PERM_SIGN_CLOSING_TX) != 0; case WIRE_HSMD_SIGN_SPLICE_TX: - return (client->capabilities & WIRE_HSMD_SIGN_SPLICE_TX) != 0; + return (client->capabilities & HSM_PERM_SIGN_SPLICE_TX) != 0; case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER: return (client->capabilities & HSM_PERM_SIGN_WILL_FUND_OFFER) != 0; diff --git a/hsmd/permissions.h b/hsmd/permissions.h index d91ea2272..afc396c22 100644 --- a/hsmd/permissions.h +++ b/hsmd/permissions.h @@ -9,6 +9,7 @@ #define HSM_PERM_SIGN_REMOTE_TX 16 #define HSM_PERM_SIGN_CLOSING_TX 32 #define HSM_PERM_SIGN_WILL_FUND_OFFER 64 +#define HSM_PERM_SIGN_SPLICE_TX 128 #define HSM_PERM_MASTER 1024 #endif /* LIGHTNING_HSMD_PERMISSIONS_H */ diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index 0553692a5..cd59faf91 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -1269,7 +1269,8 @@ bool peer_start_channeld(struct channel *channel, | HSM_PERM_COMMITMENT_POINT | HSM_PERM_SIGN_REMOTE_TX | HSM_PERM_SIGN_ONCHAIN_TX - | HSM_PERM_SIGN_CLOSING_TX); + | HSM_PERM_SIGN_CLOSING_TX + | HSM_PERM_SIGN_SPLICE_TX); channel_set_owner(channel, new_channel_subd(channel, ld,