We need to initialize master runes secret early, so db can use rune_is_ours */
| 162 | |
| 163 | /* We need to initialize master runes secret early, so db can use rune_is_ours */ |
| 164 | struct 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 | |
| 183 | static void blacklist_to_bitmap(const struct rune_blacklist *blist, |
| 184 | bitmap *bitmap, size_t nbits) |
no test coverage detected