You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split NetworkGraph message handling fns into unsigned and signed
This takes the now-public `NetworkGraph` message handling functions
and splits them all into two methods - one which takes a required
Secp256k1 context and verifies signatures and one which takes only
the unsigned part of the message and does not take a Secp256k1
context.
This both clarifies the public API as well as simplifies it, all
without duplicating code.
Finally, this adds an assertion in the Router fuzzer to make sure
the constants used for message deserialization are correct.
let start_len = slice_to_be16(&get_slice_nonadvancing!(64 + 2)[64..64 + 2])asusize;
166
-
let addr_len = slice_to_be16(&get_slice_nonadvancing!(64+start_len+2 + 74)[64+start_len+2 + 72..64+start_len+2 + 74]);
166
+
let start_len = slice_to_be16(&get_slice_nonadvancing!(2)[0..2])asusize;
167
+
let addr_len = slice_to_be16(&get_slice_nonadvancing!(start_len+2 + 74)[start_len+2 + 72..start_len+2 + 74]);
167
168
if addr_len > (37+1)*4{
168
169
return;
169
170
}
170
-
let msg = decode_msg_with_len16!(msgs::NodeAnnouncement,64,288);
171
-
node_pks.insert(msg.contents.node_id);
172
-
let _ = net_graph.update_node_from_announcement::<secp256k1::VerifyOnly>(&msg,None);
171
+
let msg = decode_msg_with_len16!(msgs::UnsignedNodeAnnouncement,288);
172
+
node_pks.insert(msg.node_id);
173
+
let _ = net_graph.update_node_from_unsigned_announcement(&msg);
173
174
},
174
175
1 => {
175
-
let msg = decode_msg_with_len16!(msgs::ChannelAnnouncement,64*4,32+8+33*4);
176
-
node_pks.insert(msg.contents.node_id_1);
177
-
node_pks.insert(msg.contents.node_id_2);
178
-
let _ = net_graph.update_channel_from_announcement::<secp256k1::VerifyOnly,&FuzzChainSource>(&msg,&None,None);
176
+
let msg = decode_msg_with_len16!(msgs::UnsignedChannelAnnouncement,32+8+33*4);
177
+
node_pks.insert(msg.node_id_1);
178
+
node_pks.insert(msg.node_id_2);
179
+
let _ = net_graph.update_channel_from_unsigned_announcement::<&FuzzChainSource>(&msg,&None);
179
180
},
180
181
2 => {
181
-
let msg = decode_msg_with_len16!(msgs::ChannelAnnouncement,64*4,32+8+33*4);
182
-
node_pks.insert(msg.contents.node_id_1);
183
-
node_pks.insert(msg.contents.node_id_2);
184
-
let _ = net_graph.update_channel_from_announcement::<secp256k1::VerifyOnly,&FuzzChainSource>(&msg,&Some(&FuzzChainSource{input:Arc::clone(&input)}),None);
182
+
let msg = decode_msg_with_len16!(msgs::UnsignedChannelAnnouncement,32+8+33*4);
183
+
node_pks.insert(msg.node_id_1);
184
+
node_pks.insert(msg.node_id_2);
185
+
let _ = net_graph.update_channel_from_unsigned_announcement(&msg,&Some(&FuzzChainSource{input:Arc::clone(&input)}));
185
186
},
186
187
3 => {
187
-
let _ = net_graph.update_channel(&decode_msg!(msgs::ChannelUpdate,136),None);
188
+
let _ = net_graph.update_channel_unsigned(&decode_msg!(msgs::UnsignedChannelUpdate,72));
188
189
},
189
190
4 => {
190
191
let short_channel_id = slice_to_be64(get_slice!(8));
0 commit comments