| 1540 | |
| 1541 | |
| 1542 | static struct command_result * |
| 1543 | connect_ok(struct command *cmd, |
| 1544 | const char *method, |
| 1545 | const char *buf, |
| 1546 | const jsmntok_t *result, |
| 1547 | struct multifundchannel_destination *dest) |
| 1548 | { |
| 1549 | struct multifundchannel_command *mfc = dest->mfc; |
| 1550 | const jsmntok_t *features_tok; |
| 1551 | |
| 1552 | plugin_log(mfc->cmd->plugin, LOG_DBG, |
| 1553 | "mfc %"PRIu64", dest %u: connect done.", |
| 1554 | mfc->id, dest->index); |
| 1555 | |
| 1556 | features_tok = json_get_member(buf, result, "features"); |
| 1557 | if (!features_tok) |
| 1558 | plugin_err(cmd->plugin, |
| 1559 | "'connect' did not return 'features'? %.*s", |
| 1560 | json_tok_full_len(result), |
| 1561 | json_tok_full(buf, result)); |
| 1562 | dest->their_features = json_tok_bin_from_hex(mfc, buf, features_tok); |
| 1563 | if (!dest->their_features) |
| 1564 | plugin_err(cmd->plugin, |
| 1565 | "'connect' has unparesable 'features'? %.*s", |
| 1566 | json_tok_full_len(features_tok), |
| 1567 | json_tok_full(buf, features_tok)); |
| 1568 | |
| 1569 | dest->state = MULTIFUNDCHANNEL_CONNECTED; |
| 1570 | |
| 1571 | /* Set the open protocol to use now */ |
| 1572 | if (feature_negotiated(plugin_feature_set(mfc->cmd->plugin), |
| 1573 | dest->their_features, |
| 1574 | OPT_DUAL_FUND)) |
| 1575 | dest->protocol = OPEN_CHANNEL; |
| 1576 | else if (!amount_sat_is_zero(dest->request_amt) || !(!dest->rates)) |
| 1577 | /* Return an error */ |
| 1578 | fail_destination_msg(dest, FUNDING_V2_NOT_SUPPORTED, |
| 1579 | "Tried to buy a liquidity ad" |
| 1580 | " but we(?) don't have" |
| 1581 | " experimental-dual-fund" |
| 1582 | " enabled"); |
| 1583 | |
| 1584 | return connect_done(dest); |
| 1585 | } |
| 1586 | |
| 1587 | static struct command_result * |
| 1588 | connect_err(struct command *cmd, |
nothing calls this directly
no test coverage detected