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

Function check_channel_update

gossipd/routing.c:631–653  ·  view source on GitHub ↗

Verify the signature of a channel_update message */

Source from the content-addressed store, hash-verified

629
630/* Verify the signature of a channel_update message */
631static 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
655static u8 *check_channel_announcement(const tal_t *ctx,
656 const struct node_id *node1_id, const struct node_id *node2_id,

Callers 1

handle_channel_updateFunction · 0.85

Calls 5

check_signed_hash_nodeidFunction · 0.85
tal_hexFunction · 0.85
sha256_doubleClass · 0.70
towire_warningfmtFunction · 0.50
type_to_stringClass · 0.50

Tested by

no test coverage detected