| 1036 | } |
| 1037 | |
| 1038 | static struct command_result *json_dev_finalizepsbt(struct command *cmd, |
| 1039 | const char *buffer, |
| 1040 | const jsmntok_t *obj, |
| 1041 | const jsmntok_t *params) |
| 1042 | { |
| 1043 | struct wally_psbt *psbt; |
| 1044 | struct wally_tx *wtx; |
| 1045 | struct bitcoin_txid txid; |
| 1046 | struct json_stream *response; |
| 1047 | |
| 1048 | if (!param_check(cmd, buffer, params, |
| 1049 | p_req("psbt", param_psbt, &psbt), |
| 1050 | NULL)) |
| 1051 | return command_param_failed(); |
| 1052 | |
| 1053 | if (!psbt_finalize(psbt)) |
| 1054 | return command_fail(cmd, JSONRPC2_INVALID_PARAMS, |
| 1055 | "PSBT not finalizeable"); |
| 1056 | |
| 1057 | wtx = psbt_final_tx(cmd, psbt); |
| 1058 | wally_txid(wtx, &txid); |
| 1059 | |
| 1060 | response = json_stream_success(cmd); |
| 1061 | json_add_psbt(response, "psbt", psbt); |
| 1062 | json_add_hex_talarr(response, "tx", linearize_wtx(tmpctx, wtx)); |
| 1063 | json_add_txid(response, "txid", &txid); |
| 1064 | return command_success(cmd, response); |
| 1065 | } |
| 1066 | |
| 1067 | static const struct json_command dev_finalizepsbt_command = { |
| 1068 | "dev-finalizepsbt", |
nothing calls this directly
no test coverage detected