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

Function runes_early_init

lightningd/runes.c:164–181  ·  view source on GitHub ↗

We need to initialize master runes secret early, so db can use rune_is_ours */

Source from the content-addressed store, hash-verified

162
163/* We need to initialize master runes secret early, so db can use rune_is_ours */
164struct runes *runes_early_init(struct lightningd *ld)
165{
166 const u8 *msg;
167 struct runes *runes = tal(ld, struct runes);
168 const u8 *data;
169 struct secret secret;
170
171 data = tal_dup_arr(tmpctx, u8, (u8 *)RUNES_SECRET_LABEL,
172 strlen(RUNES_SECRET_LABEL), 0);
173 msg = hsm_sync_req(tmpctx, ld, towire_hsmd_derive_secret(tmpctx, data));
174 if (!fromwire_hsmd_derive_secret_reply(msg, &secret))
175 fatal("Bad reply from HSM: %s", tal_hex(tmpctx, msg));
176
177 runes->ld = ld;
178 runes->master = rune_new(runes, secret.data, ARRAY_SIZE(secret.data), NULL);
179
180 return runes;
181}
182
183static void blacklist_to_bitmap(const struct rune_blacklist *blist,
184 bitmap *bitmap, size_t nbits)

Callers 1

mainFunction · 0.70

Calls 6

tal_hexFunction · 0.85
rune_newFunction · 0.85
hsm_sync_reqFunction · 0.70
fatalFunction · 0.70

Tested by

no test coverage detected