| 1865 | } |
| 1866 | |
| 1867 | static void handle_dry_run_finished(struct subd *dualopend, const u8 *msg) |
| 1868 | { |
| 1869 | struct json_stream *response; |
| 1870 | struct channel_id c_id; |
| 1871 | struct channel *channel = dualopend->channel; |
| 1872 | struct command *cmd; |
| 1873 | struct lease_rates *rates; |
| 1874 | struct amount_sat their_funding, our_funding; |
| 1875 | bool requires_confirms; |
| 1876 | |
| 1877 | assert(channel->open_attempt); |
| 1878 | cmd = channel->open_attempt->cmd; |
| 1879 | channel->open_attempt->cmd = NULL; |
| 1880 | |
| 1881 | if (!fromwire_dualopend_dry_run(msg, msg, &c_id, |
| 1882 | &our_funding, |
| 1883 | &their_funding, |
| 1884 | &requires_confirms, |
| 1885 | &rates)) { |
| 1886 | channel_internal_error(channel, |
| 1887 | "Bad WIRE_DUALOPEND_DRY_RUN_FINISHED: %s", |
| 1888 | tal_hex(msg, msg)); |
| 1889 | |
| 1890 | return; |
| 1891 | } |
| 1892 | |
| 1893 | /* Free up this open attempt */ |
| 1894 | channel->open_attempt = tal_free(channel->open_attempt); |
| 1895 | |
| 1896 | response = json_stream_success(cmd); |
| 1897 | json_add_amount_sat_msat(response, "our_funding_msat", our_funding); |
| 1898 | json_add_amount_sat_msat(response, "their_funding_msat", their_funding); |
| 1899 | json_add_bool(response, "requires_confirmed_inputs", requires_confirms); |
| 1900 | |
| 1901 | if (rates) { |
| 1902 | json_add_lease_rates(response, rates); |
| 1903 | /* As a convenience, add a hexstring version of this data */ |
| 1904 | json_add_string(response, "compact_lease", |
| 1905 | lease_rates_tohex(tmpctx, rates)); |
| 1906 | } |
| 1907 | |
| 1908 | was_pending(command_success(cmd, response)); |
| 1909 | } |
| 1910 | |
| 1911 | static void handle_peer_locked(struct subd *dualopend, const u8 *msg) |
| 1912 | { |
no test coverage detected