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

Function after_fundpsbt

plugins/spender/multifundchannel.c:1323–1372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1321}
1322
1323static struct command_result *
1324after_fundpsbt(struct command *cmd,
1325 const char *buf,
1326 const jsmntok_t *result,
1327 struct multifundchannel_command *mfc)
1328{
1329 const jsmntok_t *field;
1330 struct amount_msat msat;
1331
1332 plugin_log(mfc->cmd->plugin, LOG_DBG,
1333 "mfc %"PRIu64": %s done.",
1334 mfc->id, mfc->utxos_str ? "utxopsbt" : "fundpsbt");
1335
1336 field = json_get_member(buf, result, "psbt");
1337 if (!field)
1338 goto fail;
1339
1340 mfc->psbt = psbt_from_b64(mfc,
1341 buf + field->start,
1342 field->end - field->start);
1343 if (!mfc->psbt)
1344 goto fail;
1345
1346 field = json_get_member(buf, result, "feerate_per_kw");
1347 if (!field || !json_to_u32(buf, field, &mfc->feerate_per_kw))
1348 goto fail;
1349
1350 field = json_get_member(buf, result, "estimated_final_weight");
1351 if (!field || !json_to_u32(buf, field, &mfc->estimated_final_weight))
1352 goto fail;
1353
1354 /* msat LOL. */
1355 field = json_get_member(buf, result, "excess_msat");
1356 if (!field || !parse_amount_msat(&msat,
1357 buf + field->start,
1358 field->end - field->start)
1359 || !amount_msat_to_sat(&mfc->excess_sat, msat))
1360 goto fail;
1361
1362 if (has_all(mfc))
1363 return compute_mfc_all(mfc);
1364 return handle_mfc_change(mfc);
1365
1366fail:
1367 plugin_err(mfc->cmd->plugin,
1368 "Unexpected result from fundpsbt/utxopsbt: %.*s",
1369 json_tok_full_len(result),
1370 json_tok_full(buf, result));
1371
1372}
1373
1374static struct command_result *
1375perform_fundpsbt(struct multifundchannel_command *mfc, u32 feerate)

Callers

nothing calls this directly

Calls 12

psbt_from_b64Function · 0.85
amount_msat_to_satFunction · 0.85
has_allFunction · 0.85
compute_mfc_allFunction · 0.85
handle_mfc_changeFunction · 0.85
plugin_logFunction · 0.50
json_get_memberFunction · 0.50
json_to_u32Function · 0.50
parse_amount_msatFunction · 0.50
plugin_errFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50

Tested by

no test coverage detected