| 1666 | } |
| 1667 | |
| 1668 | static void handle_dry_run_finished(struct subd *dualopend, const u8 *msg) |
| 1669 | { |
| 1670 | struct json_stream *response; |
| 1671 | struct channel_id c_id; |
| 1672 | struct channel *channel = dualopend->channel; |
| 1673 | struct command *cmd; |
| 1674 | struct lease_rates *rates; |
| 1675 | struct amount_sat their_funding, our_funding; |
| 1676 | |
| 1677 | assert(channel->open_attempt); |
| 1678 | cmd = channel->open_attempt->cmd; |
| 1679 | channel->open_attempt->cmd = NULL; |
| 1680 | |
| 1681 | if (!fromwire_dualopend_dry_run(msg, msg, &c_id, |
| 1682 | &our_funding, |
| 1683 | &their_funding, |
| 1684 | &rates)) { |
| 1685 | channel_internal_error(channel, |
| 1686 | "Bad WIRE_DUALOPEND_DRY_RUN_FINISHED: %s", |
| 1687 | tal_hex(msg, msg)); |
| 1688 | |
| 1689 | return; |
| 1690 | } |
| 1691 | |
| 1692 | /* Free up this open attempt */ |
| 1693 | channel->open_attempt = tal_free(channel->open_attempt); |
| 1694 | |
| 1695 | response = json_stream_success(cmd); |
| 1696 | json_add_amount_sat_msat(response, "our_funding_msat", our_funding); |
| 1697 | json_add_amount_sat_msat(response, "their_funding_msat", their_funding); |
| 1698 | |
| 1699 | if (rates) { |
| 1700 | json_add_lease_rates(response, rates); |
| 1701 | /* As a convenience, add a hexstring version of this data */ |
| 1702 | json_add_string(response, "compact_lease", |
| 1703 | lease_rates_tohex(tmpctx, rates)); |
| 1704 | } |
| 1705 | |
| 1706 | was_pending(command_success(cmd, response)); |
| 1707 | } |
| 1708 | |
| 1709 | static void handle_peer_locked(struct subd *dualopend, const u8 *msg) |
| 1710 | { |
no test coverage detected