Verify the signature of a channel_update message */
| 629 | |
| 630 | /* Verify the signature of a channel_update message */ |
| 631 | static u8 *check_channel_update(const tal_t *ctx, |
| 632 | const struct node_id *node_id, |
| 633 | const secp256k1_ecdsa_signature *node_sig, |
| 634 | const u8 *update) |
| 635 | { |
| 636 | /* 2 byte msg type + 64 byte signatures */ |
| 637 | int offset = 66; |
| 638 | struct sha256_double hash; |
| 639 | sha256_double(&hash, update + offset, tal_count(update) - offset); |
| 640 | |
| 641 | if (!check_signed_hash_nodeid(&hash, node_sig, node_id)) |
| 642 | return towire_warningfmt(ctx, NULL, |
| 643 | "Bad signature for %s hash %s" |
| 644 | " on channel_update %s", |
| 645 | type_to_string(tmpctx, |
| 646 | secp256k1_ecdsa_signature, |
| 647 | node_sig), |
| 648 | type_to_string(tmpctx, |
| 649 | struct sha256_double, |
| 650 | &hash), |
| 651 | tal_hex(tmpctx, update)); |
| 652 | return NULL; |
| 653 | } |
| 654 | |
| 655 | static u8 *check_channel_announcement(const tal_t *ctx, |
| 656 | const struct node_id *node1_id, const struct node_id *node2_id, |
no test coverage detected