| 312 | } |
| 313 | |
| 314 | static bool print_signature(const char *messagename, |
| 315 | const char *fieldname, |
| 316 | const struct tlv_field *fields, |
| 317 | const struct pubkey *node_id, |
| 318 | const struct bip340sig *sig) |
| 319 | { |
| 320 | struct sha256 m, shash; |
| 321 | |
| 322 | /* No key, it's already invalid */ |
| 323 | if (!node_id) |
| 324 | return false; |
| 325 | |
| 326 | merkle_tlv(fields, &m); |
| 327 | sighash_from_merkle(messagename, fieldname, &m, &shash); |
| 328 | if (!check_schnorr_sig(&shash, &node_id->pubkey, sig)) { |
| 329 | fprintf(stderr, "%s: INVALID\n", fieldname); |
| 330 | return false; |
| 331 | } |
| 332 | printf("%s: %s\n", |
| 333 | fieldname, |
| 334 | fmt_bip340sig(tmpctx, sig)); |
| 335 | return true; |
| 336 | } |
| 337 | |
| 338 | static void print_recurrence_counter(const u32 *recurrence_counter, |
| 339 | const u32 *recurrence_start) |
no test coverage detected