| 1072 | } |
| 1073 | |
| 1074 | static struct command_result *json_dev_finalizepsbt(struct command *cmd, |
| 1075 | const char *buffer, |
| 1076 | const jsmntok_t *obj, |
| 1077 | const jsmntok_t *params) |
| 1078 | { |
| 1079 | struct wally_psbt *psbt; |
| 1080 | struct wally_tx *wtx; |
| 1081 | struct bitcoin_txid txid; |
| 1082 | struct json_stream *response; |
| 1083 | |
| 1084 | if (!param_check(cmd, buffer, params, |
| 1085 | p_req("psbt", param_psbt, &psbt), |
| 1086 | NULL)) |
| 1087 | return command_param_failed(); |
| 1088 | |
| 1089 | if (!psbt_finalize(psbt)) |
| 1090 | return command_fail(cmd, JSONRPC2_INVALID_PARAMS, |
| 1091 | "PSBT not finalizeable"); |
| 1092 | |
| 1093 | wtx = psbt_final_tx(cmd, psbt); |
| 1094 | wally_txid(wtx, &txid); |
| 1095 | |
| 1096 | response = json_stream_success(cmd); |
| 1097 | json_add_psbt(response, "psbt", psbt); |
| 1098 | json_add_hex_talarr(response, "tx", linearize_wtx(tmpctx, wtx)); |
| 1099 | json_add_txid(response, "txid", &txid); |
| 1100 | return command_success(cmd, response); |
| 1101 | } |
| 1102 | |
| 1103 | static const struct json_command dev_finalizepsbt_command = { |
| 1104 | "dev-finalizepsbt", |
nothing calls this directly
no test coverage detected