From 4e7f89f211523e2fac8ce0435137b17a255133c0 Mon Sep 17 00:00:00 2001 From: niftynei Date: Thu, 11 Aug 2022 16:37:11 -0500 Subject: [PATCH] signpsbt: don't crash if HSM doesn't like your psbt, just return err Changelog-Changed: JSON-RPC: `signpsbt` no longer crashes if it doesn't like what your PSBT is --- wallet/walletrpc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index 47f38e13d..4d2ab3c1c 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -789,8 +789,9 @@ static struct command_result *json_signpsbt(struct command *cmd, msg = wire_sync_read(cmd, cmd->ld->hsm_fd); if (!fromwire_hsmd_sign_withdrawal_reply(cmd, msg, &signed_psbt)) - fatal("HSM gave bad sign_withdrawal_reply %s", - tal_hex(tmpctx, msg)); + return command_fail(cmd, JSONRPC2_INVALID_PARAMS, + "HSM gave bad sign_withdrawal_reply %s", + tal_hex(tmpctx, msg)); response = json_stream_success(cmd); json_add_psbt(response, "signed_psbt", signed_psbt);