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

Function add_connection

plugins/renepay/test/common.h:44–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44static void add_connection(int store_fd,
45 const struct node_id *from,
46 const struct node_id *to,
47 struct short_channel_id scid,
48 struct amount_msat min,
49 struct amount_msat max,
50 u32 base_fee, s32 proportional_fee,
51 u32 delay,
52 struct amount_sat capacity)
53{
54 secp256k1_ecdsa_signature dummy_sig;
55 struct secret not_a_secret;
56 struct pubkey dummy_key;
57 u8 *msg;
58 const struct node_id *ids[2];
59
60 /* So valgrind doesn't complain */
61 memset(&dummy_sig, 0, sizeof(dummy_sig));
62 memset(&not_a_secret, 1, sizeof(not_a_secret));
63 pubkey_from_secret(&not_a_secret, &dummy_key);
64
65 if (node_id_cmp(from, to) > 0) {
66 ids[0] = to;
67 ids[1] = from;
68 } else {
69 ids[0] = from;
70 ids[1] = to;
71 }
72 msg = towire_channel_announcement(tmpctx, &dummy_sig, &dummy_sig,
73 &dummy_sig, &dummy_sig,
74 /* features */ NULL,
75 &chainparams->genesis_blockhash,
76 scid,
77 ids[0], ids[1],
78 &dummy_key, &dummy_key);
79 write_to_store(store_fd, msg);
80
81 msg = towire_gossip_store_channel_amount(tmpctx, capacity);
82 write_to_store(store_fd, msg);
83
84 u8 flags = node_id_idx(from, to);
85
86 msg = towire_channel_update(tmpctx,
87 &dummy_sig,
88 &chainparams->genesis_blockhash,
89 scid, 0,
90 ROUTING_OPT_HTLC_MAX_MSAT,
91 flags,
92 delay,
93 min,
94 base_fee,
95 proportional_fee,
96 max);
97 write_to_store(store_fd, msg);
98}
99
100static void node_id_from_privkey(const struct privkey *p, struct node_id *id)
101{

Callers 1

mainFunction · 0.70

Calls 4

pubkey_from_secretFunction · 0.85
node_id_cmpFunction · 0.85
node_id_idxFunction · 0.85
write_to_storeFunction · 0.70

Tested by

no test coverage detected