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
This commit is contained in:
niftynei 2022-08-11 16:37:11 -05:00 committed by neil saitug
parent 4984014578
commit 4e7f89f211

View file

@ -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);