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

Function accepter_got_offer

lightningd/dual_open_control.c:1862–1921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1860}
1861
1862static void accepter_got_offer(struct subd *dualopend,
1863 struct channel *channel,
1864 const u8 *msg)
1865{
1866 struct openchannel2_payload *payload;
1867
1868 if (channel->open_attempt) {
1869 subd_send_msg(dualopend,
1870 take(towire_dualopend_fail(NULL,
1871 "Already initiated channel open")));
1872 return;
1873 }
1874
1875 payload = tal(dualopend, struct openchannel2_payload);
1876 payload->dualopend = dualopend;
1877 payload->channel = channel;
1878 payload->psbt = NULL;
1879 payload->accepter_funding = AMOUNT_SAT(0);
1880 payload->our_shutdown_scriptpubkey = NULL;
1881 payload->peer_id = channel->peer->id;
1882 payload->err_msg = NULL;
1883
1884 if (!fromwire_dualopend_got_offer(payload, msg,
1885 &payload->channel_id,
1886 &payload->their_funding,
1887 &payload->dust_limit_satoshis,
1888 &payload->max_htlc_value_in_flight_msat,
1889 &payload->htlc_minimum_msat,
1890 &payload->funding_feerate_per_kw,
1891 &payload->commitment_feerate_per_kw,
1892 &payload->to_self_delay,
1893 &payload->max_accepted_htlcs,
1894 &payload->channel_flags,
1895 &payload->locktime,
1896 &payload->shutdown_scriptpubkey,
1897 &payload->requested_lease_amt,
1898 &payload->lease_blockheight_start)) {
1899 channel_internal_error(channel, "Bad DUALOPEND_GOT_OFFER: %s",
1900 tal_hex(tmpctx, msg));
1901 return;
1902 }
1903
1904 /* As a convenience to the plugin, we provide our current known
1905 * min + max feerates. Ideally, the plugin will fail to
1906 * contribute funds if the peer's feerate range is outside of
1907 * this acceptable range, but we delegate that decision to
1908 * the plugin */
1909 payload->feerate_our_min = feerate_min(dualopend->ld, NULL);
1910 payload->feerate_our_max = feerate_max(dualopend->ld, NULL);
1911 payload->node_blockheight = get_block_height(dualopend->ld->topology);
1912
1913 payload->channel_max = chainparams->max_funding;
1914 if (feature_negotiated(dualopend->ld->our_features,
1915 channel->peer->their_features,
1916 OPT_LARGE_CHANNELS))
1917 payload->channel_max = AMOUNT_SAT(UINT64_MAX);
1918
1919 tal_add_destructor2(dualopend, openchannel2_remove_dualopend, payload);

Callers 1

dual_opend_msgFunction · 0.85

Calls 7

tal_hexFunction · 0.85
feerate_minFunction · 0.85
feerate_maxFunction · 0.85
subd_send_msgFunction · 0.70
channel_internal_errorFunction · 0.70
get_block_heightFunction · 0.70
feature_negotiatedFunction · 0.50

Tested by

no test coverage detected