~ It's optional for nodes to send node_announcement, but it lets us set our * favourite color and cool alias! Plus other minor details like how to * connect to us. */
| 909 | * favourite color and cool alias! Plus other minor details like how to |
| 910 | * connect to us. */ |
| 911 | static u8 *handle_sign_node_announcement(struct hsmd_client *c, |
| 912 | const u8 *msg_in) |
| 913 | { |
| 914 | /* BOLT #7: |
| 915 | * |
| 916 | * The origin node: |
| 917 | *... |
| 918 | * - MUST set `signature` to the signature of the double-SHA256 of the |
| 919 | * entire remaining packet after `signature` (using the key given by |
| 920 | * `node_id`). |
| 921 | */ |
| 922 | /* 2 bytes msg type + 64 bytes signature */ |
| 923 | size_t offset = 66; |
| 924 | struct sha256_double hash; |
| 925 | struct privkey node_pkey; |
| 926 | secp256k1_ecdsa_signature sig; |
| 927 | u8 *reply; |
| 928 | u8 *ann; |
| 929 | |
| 930 | if (!fromwire_hsmd_node_announcement_sig_req(tmpctx, msg_in, &ann)) |
| 931 | return hsmd_status_malformed_request(c, msg_in); |
| 932 | |
| 933 | if (tal_count(ann) < offset) |
| 934 | return hsmd_status_bad_request(c, msg_in, |
| 935 | "Node announcement too short"); |
| 936 | |
| 937 | if (fromwire_peektype(ann) != WIRE_NODE_ANNOUNCEMENT) |
| 938 | return hsmd_status_bad_request(c, msg_in, |
| 939 | "Invalid announcement"); |
| 940 | |
| 941 | node_key(&node_pkey, NULL); |
| 942 | sha256_double(&hash, ann + offset, tal_count(ann) - offset); |
| 943 | |
| 944 | sign_hash(&node_pkey, &hash, &sig); |
| 945 | |
| 946 | reply = towire_hsmd_node_announcement_sig_reply(NULL, &sig); |
| 947 | return reply; |
| 948 | } |
| 949 | |
| 950 | /*~ The specific routine to sign the channel_update message. */ |
| 951 | static u8 *handle_channel_update_sig(struct hsmd_client *c, const u8 *msg_in) |
no test coverage detected