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

Function channel_config

lightningd/opening_common.c:129–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129void channel_config(struct lightningd *ld,
130 struct channel_config *ours,
131 u32 *max_to_self_delay,
132 struct amount_msat *min_effective_htlc_capacity)
133{
134 /* FIXME: depend on feerate. */
135 *max_to_self_delay = ld->config.max_htlc_cltv;
136
137 /* Take minimal effective capacity from config min_capacity_sat */
138 if (!amount_sat_to_msat(min_effective_htlc_capacity,
139 amount_sat(ld->config.min_capacity_sat)))
140 fatal("amount_msat overflow for config.min_capacity_sat");
141
142 /* BOLT #2:
143 *
144 * The sending node SHOULD:
145 *...
146 * - set `dust_limit_satoshis` to a sufficient value to allow
147 * commitment transactions to propagate through the Bitcoin network.
148 */
149 ours->dust_limit = chainparams->dust_limit;
150 ours->max_htlc_value_in_flight = AMOUNT_MSAT(UINT64_MAX);
151
152 ours->max_dust_htlc_exposure_msat
153 = ld->config.max_dust_htlc_exposure_msat;
154
155 /* Don't care */
156 ours->htlc_minimum = ld->config.htlc_minimum_msat;
157
158 /* BOLT #2:
159 *
160 * The sending node SHOULD:
161 * - set `to_self_delay` sufficient to ensure the sender can
162 * irreversibly spend a commitment transaction output, in case of
163 * misbehavior by the receiver.
164 */
165 ours->to_self_delay = ld->config.locktime_blocks;
166
167 ours->max_accepted_htlcs = ld->config.max_concurrent_htlcs;
168
169 /* This is filled in by lightning_openingd, for consistency. */
170 ours->channel_reserve = AMOUNT_SAT(UINT64_MAX);
171}

Callers

nothing calls this directly

Calls 3

amount_satClass · 0.70
fatalFunction · 0.70
amount_sat_to_msatFunction · 0.50

Tested by

no test coverage detected