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

Function add_connection

plugins/test/run-route-overlong.c:171–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171static void add_connection(int store_fd,
172 const struct node_id *from,
173 const struct node_id *to,
174 struct short_channel_id scid,
175 struct amount_msat min,
176 struct amount_msat max,
177 u32 base_fee, s32 proportional_fee,
178 u32 delay)
179{
180 secp256k1_ecdsa_signature dummy_sig;
181 struct secret not_a_secret;
182 struct pubkey dummy_key;
183 u8 *msg;
184 const struct node_id *ids[2];
185
186 /* So valgrind doesn't complain */
187 memset(&dummy_sig, 0, sizeof(dummy_sig));
188 memset(&not_a_secret, 1, sizeof(not_a_secret));
189 pubkey_from_secret(&not_a_secret, &dummy_key);
190
191 if (node_id_cmp(from, to) > 0) {
192 ids[0] = to;
193 ids[1] = from;
194 } else {
195 ids[0] = from;
196 ids[1] = to;
197 }
198 msg = towire_channel_announcement(tmpctx, &dummy_sig, &dummy_sig,
199 &dummy_sig, &dummy_sig,
200 /* features */ NULL,
201 &chainparams->genesis_blockhash,
202 scid,
203 ids[0], ids[1],
204 &dummy_key, &dummy_key);
205 write_to_store(store_fd, msg);
206 tal_free(msg);
207
208 /* Also needs a hint as to the funding size. */
209 struct amount_sat capacity = AMOUNT_SAT(100000000);
210 msg = towire_gossip_store_channel_amount(tmpctx, capacity);
211 write_to_store(store_fd, msg);
212 tal_free(msg);
213
214 update_connection(store_fd, from, to, scid, min, max, base_fee,
215 proportional_fee, delay, false);
216}
217
218static void node_id_from_privkey(const struct privkey *p, struct node_id *id)
219{

Callers 1

mainFunction · 0.70

Calls 5

pubkey_from_secretFunction · 0.85
node_id_cmpFunction · 0.85
tal_freeFunction · 0.85
write_to_storeFunction · 0.70
update_connectionFunction · 0.70

Tested by

no test coverage detected