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

Function json_dev_finalizepsbt

wallet/walletrpc.c:1074–1101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1072}
1073
1074static 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
1103static const struct json_command dev_finalizepsbt_command = {
1104 "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