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

Function accepter_got_offer

lightningd/dual_open_control.c:2043–2115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2041}
2042
2043static void accepter_got_offer(struct subd *dualopend,
2044 struct channel *channel,
2045 const u8 *msg)
2046{
2047 struct openchannel2_payload *payload;
2048
2049 if (channel->open_attempt) {
2050 subd_send_msg(dualopend,
2051 take(towire_dualopend_fail(NULL,
2052 "Already initiated channel open")));
2053 return;
2054 }
2055
2056 payload = tal(dualopend, struct openchannel2_payload);
2057 payload->dualopend = dualopend;
2058 payload->channel = channel;
2059 payload->psbt = NULL;
2060 payload->accepter_funding = AMOUNT_SAT(0);
2061 payload->our_shutdown_scriptpubkey = NULL;
2062 payload->peer_id = channel->peer->id;
2063 payload->rates = NULL;
2064 payload->err_msg = NULL;
2065
2066 if (!fromwire_dualopend_got_offer(payload, msg,
2067 &payload->channel_id,
2068 &payload->their_funding,
2069 &payload->dust_limit_satoshis,
2070 &payload->max_htlc_value_in_flight_msat,
2071 &payload->htlc_minimum_msat,
2072 &payload->funding_feerate_per_kw,
2073 &payload->commitment_feerate_per_kw,
2074 &payload->to_self_delay,
2075 &payload->max_accepted_htlcs,
2076 &payload->channel_flags,
2077 &payload->locktime,
2078 &payload->shutdown_scriptpubkey,
2079 &payload->requested_lease_amt,
2080 &payload->lease_blockheight_start,
2081 &payload->req_confirmed_ins_remote,
2082 &payload->channel_type)) {
2083 channel_internal_error(channel, "Bad DUALOPEND_GOT_OFFER: %s",
2084 tal_hex(tmpctx, msg));
2085 return;
2086 }
2087
2088 /* Don't allow opening if we don't know any fees; even if
2089 * ignore-feerates is set. */
2090 if (unknown_feerates(dualopend->ld->topology)) {
2091 subd_send_msg(dualopend,
2092 take(towire_dualopend_fail(NULL, "Cannot accept channel: feerates unknown")));
2093 tal_free(payload);
2094 return;
2095 }
2096
2097 /* As a convenience to the plugin, we provide our current known
2098 * min + max feerates. Ideally, the plugin will fail to
2099 * contribute funds if the peer's feerate range is outside of
2100 * this acceptable range, but we delegate that decision to

Callers 1

dual_opend_msgFunction · 0.85

Calls 9

tal_hexFunction · 0.85
unknown_feeratesFunction · 0.85
tal_freeFunction · 0.85
feerate_minFunction · 0.85
feerate_maxFunction · 0.85
feature_negotiatedFunction · 0.85
subd_send_msgFunction · 0.70
channel_internal_errorFunction · 0.70
get_block_heightFunction · 0.70

Tested by

no test coverage detected