| 1594 | |
| 1595 | |
| 1596 | static struct command_result * |
| 1597 | connect_ok(struct command *cmd, |
| 1598 | const char *buf, |
| 1599 | const jsmntok_t *result, |
| 1600 | struct multifundchannel_destination *dest) |
| 1601 | { |
| 1602 | struct multifundchannel_command *mfc = dest->mfc; |
| 1603 | const jsmntok_t *features_tok; |
| 1604 | |
| 1605 | plugin_log(mfc->cmd->plugin, LOG_DBG, |
| 1606 | "mfc %"PRIu64", dest %u: connect done.", |
| 1607 | mfc->id, dest->index); |
| 1608 | |
| 1609 | features_tok = json_get_member(buf, result, "features"); |
| 1610 | if (!features_tok) |
| 1611 | plugin_err(cmd->plugin, |
| 1612 | "'connect' did not return 'features'? %.*s", |
| 1613 | json_tok_full_len(result), |
| 1614 | json_tok_full(buf, result)); |
| 1615 | dest->their_features = json_tok_bin_from_hex(mfc, buf, features_tok); |
| 1616 | if (!dest->their_features) |
| 1617 | plugin_err(cmd->plugin, |
| 1618 | "'connect' has unparesable 'features'? %.*s", |
| 1619 | json_tok_full_len(features_tok), |
| 1620 | json_tok_full(buf, features_tok)); |
| 1621 | |
| 1622 | dest->state = MULTIFUNDCHANNEL_CONNECTED; |
| 1623 | |
| 1624 | /* Set the open protocol to use now */ |
| 1625 | if (feature_negotiated(plugin_feature_set(mfc->cmd->plugin), |
| 1626 | dest->their_features, |
| 1627 | OPT_DUAL_FUND)) |
| 1628 | dest->protocol = OPEN_CHANNEL; |
| 1629 | else if (!amount_sat_zero(dest->request_amt) || !(!dest->rates)) |
| 1630 | /* Return an error */ |
| 1631 | fail_destination_msg(dest, FUNDING_V2_NOT_SUPPORTED, |
| 1632 | "Tried to buy a liquidity ad" |
| 1633 | " but we(?) don't have" |
| 1634 | " experimental-dual-fund" |
| 1635 | " enabled"); |
| 1636 | |
| 1637 | return connect_done(dest); |
| 1638 | } |
| 1639 | |
| 1640 | static struct command_result * |
| 1641 | connect_err(struct command *cmd, |
nothing calls this directly
no test coverage detected