| 1321 | } |
| 1322 | |
| 1323 | static struct command_result * |
| 1324 | after_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 | |
| 1366 | fail: |
| 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 | |
| 1374 | static struct command_result * |
| 1375 | perform_fundpsbt(struct multifundchannel_command *mfc, u32 feerate) |
nothing calls this directly
no test coverage detected