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

Function add_connection

common/test/run-route-specific.c:98–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98static void add_connection(int store_fd,
99 const struct node_id *from,
100 const struct node_id *to,
101 const char *shortid,
102 struct amount_msat min,
103 struct amount_msat max,
104 u32 base_fee, s32 proportional_fee,
105 u32 delay)
106{
107 struct short_channel_id scid;
108 secp256k1_ecdsa_signature dummy_sig;
109 struct secret not_a_secret;
110 struct pubkey dummy_key;
111 u8 *msg;
112 const struct node_id *ids[2];
113
114 /* So valgrind doesn't complain */
115 memset(&dummy_sig, 0, sizeof(dummy_sig));
116 memset(&not_a_secret, 1, sizeof(not_a_secret));
117 pubkey_from_secret(&not_a_secret, &dummy_key);
118
119 if (!short_channel_id_from_str(shortid, strlen(shortid), &scid))
120 abort();
121
122 if (node_id_cmp(from, to) > 0) {
123 ids[0] = to;
124 ids[1] = from;
125 } else {
126 ids[0] = from;
127 ids[1] = to;
128 }
129 msg = towire_channel_announcement(tmpctx, &dummy_sig, &dummy_sig,
130 &dummy_sig, &dummy_sig,
131 /* features */ NULL,
132 &chainparams->genesis_blockhash,
133 &scid,
134 ids[0], ids[1],
135 &dummy_key, &dummy_key);
136 write_to_store(store_fd, msg);
137
138 update_connection(store_fd, from, to, shortid, min, max,
139 base_fee, proportional_fee,
140 delay, false);
141}
142
143static bool channel_is_between(const struct gossmap *gossmap,
144 const struct route_hop *route,

Callers 1

mainFunction · 0.70

Calls 6

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

Tested by

no test coverage detected