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

Function init_channels

tests/fuzz/fuzz-full_channel.c:153–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153static void init_channels(const tal_t *ctx, const u8 **cursor, size_t *max,
154 struct pubkey *local_per_commitment_point,
155 struct bitcoin_outpoint *funding,
156 struct amount_sat *funding_amount,
157 u32 *blockheight,
158 struct channel **lchannel,
159 struct channel **rchannel)
160{
161 struct channel_id cid;
162 u32 feerate_per_kw[NUM_SIDES] = {fromwire_bounded_feerate(cursor, max),
163 fromwire_bounded_feerate(cursor, max)};
164 struct pubkey local_funding_pubkey, remote_funding_pubkey;
165 struct basepoints localbase, remotebase;
166 struct pubkey *unknown = tal(ctx, struct pubkey);
167 struct channel_config *local_config = tal(ctx, struct channel_config);
168 struct channel_config *remote_config = tal(ctx, struct channel_config);
169 struct amount_msat to_local = fromwire_amount_msat_bounded(cursor, max);
170 struct amount_msat to_remote = fromwire_amount_msat_bounded(cursor, max);
171 UNUSED const u8 *funding_wscript;
172
173 /* Fixed values from BOLT #3 appendix. */
174 funding->txid = txid_from_hex("8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be");
175 funding->n = 0;
176
177 *funding_amount = AMOUNT_SAT(10000000);
178 remote_config->to_self_delay = 144;
179 local_config->dust_limit = AMOUNT_SAT(546);
180 remote_config->dust_limit = AMOUNT_SAT(546);
181 local_config->max_htlc_value_in_flight = AMOUNT_MSAT(-1ULL);
182 remote_config->max_htlc_value_in_flight = AMOUNT_MSAT(-1ULL);
183 local_config->max_dust_htlc_exposure_msat = AMOUNT_MSAT(-1ULL);
184 remote_config->max_dust_htlc_exposure_msat = AMOUNT_MSAT(-1ULL);
185 local_config->channel_reserve = AMOUNT_SAT(0);
186 remote_config->channel_reserve = AMOUNT_SAT(0);
187 local_config->htlc_minimum = AMOUNT_MSAT(0);
188 remote_config->htlc_minimum = AMOUNT_MSAT(0);
189 local_config->max_accepted_htlcs = 0xFFFF;
190 remote_config->max_accepted_htlcs = 0xFFFF;
191
192 remotebase.revocation = pubkey_from_hex("02466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27");
193 localbase.delayed_payment = pubkey_from_hex("023c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1");
194 localbase.payment = pubkey_from_hex("034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa");
195 remotebase.payment = pubkey_from_hex("032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991");
196 localbase.htlc = localbase.payment;
197 remotebase.htlc = remotebase.payment;
198 localbase.revocation = *unknown;
199 remotebase.delayed_payment = *unknown;
200
201 local_funding_pubkey = pubkey_from_hex("023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb");
202 remote_funding_pubkey = pubkey_from_hex("030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c1");
203 funding_wscript = tal_hexdata(ctx, "5221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb2103"
204 "0e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae",
205 strlen("5221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb2103"
206 "0e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae"));
207 *local_per_commitment_point = pubkey_from_hex("025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486");
208
209 derive_channel_id(&cid, funding);
210

Callers 1

runFunction · 0.85

Calls 10

fromwire_bounded_feerateFunction · 0.85
tal_hexdataFunction · 0.85
derive_channel_idFunction · 0.85
new_full_channelFunction · 0.85
new_height_statesFunction · 0.85
new_fee_statesFunction · 0.85
txid_from_hexFunction · 0.70
pubkey_from_hexFunction · 0.70

Tested by

no test coverage detected