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

Function add_connection

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

Source from the content-addressed store, hash-verified

277}
278
279static void add_connection(int store_fd,
280 const struct node_id *from,
281 const struct node_id *to,
282 const struct short_channel_id *scid,
283 struct amount_msat min,
284 struct amount_msat max,
285 u32 base_fee, s32 proportional_fee,
286 u32 delay)
287{
288 secp256k1_ecdsa_signature dummy_sig;
289 struct secret not_a_secret;
290 struct pubkey dummy_key;
291 u8 *msg;
292 const struct node_id *ids[2];
293
294 /* So valgrind doesn't complain */
295 memset(&dummy_sig, 0, sizeof(dummy_sig));
296 memset(&not_a_secret, 1, sizeof(not_a_secret));
297 pubkey_from_secret(&not_a_secret, &dummy_key);
298
299 if (node_id_cmp(from, to) > 0) {
300 ids[0] = to;
301 ids[1] = from;
302 } else {
303 ids[0] = from;
304 ids[1] = to;
305 }
306 msg = towire_channel_announcement(tmpctx, &dummy_sig, &dummy_sig,
307 &dummy_sig, &dummy_sig,
308 /* features */ NULL,
309 &chainparams->genesis_blockhash,
310 scid,
311 ids[0], ids[1],
312 &dummy_key, &dummy_key);
313 write_to_store(store_fd, msg);
314
315 update_connection(store_fd, from, to, scid, min, max,
316 base_fee, proportional_fee,
317 delay, false);
318}
319
320static void node_id_from_privkey(const struct privkey *p, struct node_id *id)
321{

Callers 1

mainFunction · 0.70

Calls 4

pubkey_from_secretFunction · 0.85
write_to_storeFunction · 0.70
update_connectionFunction · 0.70
node_id_cmpFunction · 0.50

Tested by

no test coverage detected