MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_dev_finalizepsbt

Function json_dev_finalizepsbt

wallet/walletrpc.c:1038–1065  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1036}
1037
1038static 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
1067static const struct json_command dev_finalizepsbt_command = {
1068 "dev-finalizepsbt",

Callers

nothing calls this directly

Calls 12

param_checkFunction · 0.85
psbt_finalizeFunction · 0.85
psbt_final_txFunction · 0.85
wally_txidFunction · 0.85
json_add_psbtFunction · 0.85
json_add_hex_talarrFunction · 0.85
linearize_wtxFunction · 0.85
json_add_txidFunction · 0.85
command_param_failedFunction · 0.50
command_failFunction · 0.50
json_stream_successFunction · 0.50
command_successFunction · 0.50

Tested by

no test coverage detected