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

Function handle_dry_run_finished

lightningd/dual_open_control.c:1668–1707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1666}
1667
1668static 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
1709static void handle_peer_locked(struct subd *dualopend, const u8 *msg)
1710{

Callers 1

dual_opend_msgFunction · 0.85

Calls 10

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

Tested by

no test coverage detected