MCPcopy Create free account
hub / github.com/ElementsProject/lightning / handle_dry_run_finished

Function handle_dry_run_finished

lightningd/dual_open_control.c:1867–1909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1865}
1866
1867static 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
1911static void handle_peer_locked(struct subd *dualopend, const u8 *msg)
1912{

Callers 1

dual_opend_msgFunction · 0.85

Calls 11

tal_hexFunction · 0.85
tal_freeFunction · 0.85
json_add_amount_sat_msatFunction · 0.85
json_add_boolFunction · 0.85
json_add_lease_ratesFunction · 0.85
lease_rates_tohexFunction · 0.85
channel_internal_errorFunction · 0.70
json_stream_successFunction · 0.70
was_pendingFunction · 0.70
command_successFunction · 0.70
json_add_stringFunction · 0.50

Tested by

no test coverage detected