Skip to content

Commit

Permalink
signpsbt: don't crash if HSM doesn't like your psbt, just return err
Browse files Browse the repository at this point in the history
Changelog-Changed: JSON-RPC: `signpsbt` no longer crashes if it doesn't like what your PSBT is
  • Loading branch information
niftynei committed Aug 13, 2022
1 parent 4984014 commit 4e7f89f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions wallet/walletrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4e7f89f

Please sign in to comment.