@@ -162,6 +162,7 @@ impl_writeable!(ChannelInfo, 0, {
162
162
163
163
#[ derive( PartialEq ) ]
164
164
struct NodeInfo {
165
+ node_id : PublicKey ,
165
166
#[ cfg( feature = "non_bitcoin_chain_hash_routing" ) ]
166
167
channels : Vec < ( u64 , Sha256dHash ) > ,
167
168
#[ cfg( not( feature = "non_bitcoin_chain_hash_routing" ) ) ]
@@ -216,6 +217,7 @@ const MAX_ALLOC_SIZE: u64 = 64*1024;
216
217
impl Readable for NodeInfo {
217
218
fn read < R : :: std:: io:: Read > ( reader : & mut R ) -> Result < NodeInfo , DecodeError > {
218
219
let channels_count: u64 = Readable :: read ( reader) ?;
220
+ let node_id = Readable :: read ( reader) ?;
219
221
let mut channels = Vec :: with_capacity ( cmp:: min ( channels_count, MAX_ALLOC_SIZE / 8 ) as usize ) ;
220
222
for _ in 0 ..channels_count {
221
223
channels. push ( Readable :: read ( reader) ?) ;
@@ -238,6 +240,7 @@ impl Readable for NodeInfo {
238
240
}
239
241
let announcement_message = Readable :: read ( reader) ?;
240
242
Ok ( NodeInfo {
243
+ node_id,
241
244
channels,
242
245
lowest_inbound_channel_fee_base_msat,
243
246
lowest_inbound_channel_fee_proportional_millionths,
@@ -558,6 +561,7 @@ impl RoutingMessageHandler for Router {
558
561
} ,
559
562
BtreeEntry :: Vacant ( node_entry) => {
560
563
node_entry. insert( NodeInfo {
564
+ node_id: $node_id,
561
565
channels: vec!( NetworkMap :: get_key( msg. contents. short_channel_id, msg. contents. chain_hash) ) ,
562
566
lowest_inbound_channel_fee_base_msat: u32 :: max_value( ) ,
563
567
lowest_inbound_channel_fee_proportional_millionths: u32 :: max_value( ) ,
@@ -772,6 +776,7 @@ impl Router {
772
776
pub fn new ( our_pubkey : PublicKey , chain_monitor : Arc < ChainWatchInterface > , logger : Arc < Logger > ) -> Router {
773
777
let mut nodes = BTreeMap :: new ( ) ;
774
778
nodes. insert ( our_pubkey. clone ( ) , NodeInfo {
779
+ node_id : our_pubkey. clone ( ) ,
775
780
channels : Vec :: new ( ) ,
776
781
lowest_inbound_channel_fee_base_msat : u32:: max_value ( ) ,
777
782
lowest_inbound_channel_fee_proportional_millionths : u32:: max_value ( ) ,
@@ -1212,6 +1217,7 @@ mod tests {
1212
1217
let mut network = router. network_map . write ( ) . unwrap ( ) ;
1213
1218
1214
1219
network. nodes . insert ( node1. clone ( ) , NodeInfo {
1220
+ node_id : node1. clone ( ) ,
1215
1221
channels : vec ! ( NetworkMap :: get_key( 1 , zero_hash. clone( ) ) , NetworkMap :: get_key( 3 , zero_hash. clone( ) ) ) ,
1216
1222
lowest_inbound_channel_fee_base_msat : 100 ,
1217
1223
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1246,6 +1252,7 @@ mod tests {
1246
1252
announcement_message : None ,
1247
1253
} ) ;
1248
1254
network. nodes . insert ( node2. clone ( ) , NodeInfo {
1255
+ node_id : node2. clone ( ) ,
1249
1256
channels : vec ! ( NetworkMap :: get_key( 2 , zero_hash. clone( ) ) , NetworkMap :: get_key( 4 , zero_hash. clone( ) ) ) ,
1250
1257
lowest_inbound_channel_fee_base_msat : 0 ,
1251
1258
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1280,6 +1287,7 @@ mod tests {
1280
1287
announcement_message : None ,
1281
1288
} ) ;
1282
1289
network. nodes . insert ( node8. clone ( ) , NodeInfo {
1290
+ node_id : node8. clone ( ) ,
1283
1291
channels : vec ! ( NetworkMap :: get_key( 12 , zero_hash. clone( ) ) , NetworkMap :: get_key( 13 , zero_hash. clone( ) ) ) ,
1284
1292
lowest_inbound_channel_fee_base_msat : 0 ,
1285
1293
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1314,6 +1322,7 @@ mod tests {
1314
1322
announcement_message : None ,
1315
1323
} ) ;
1316
1324
network. nodes . insert ( node3. clone ( ) , NodeInfo {
1325
+ node_id : node3. clone ( ) ,
1317
1326
channels : vec ! (
1318
1327
NetworkMap :: get_key( 3 , zero_hash. clone( ) ) ,
1319
1328
NetworkMap :: get_key( 4 , zero_hash. clone( ) ) ,
@@ -1400,6 +1409,7 @@ mod tests {
1400
1409
announcement_message : None ,
1401
1410
} ) ;
1402
1411
network. nodes . insert ( node4. clone ( ) , NodeInfo {
1412
+ node_id : node4. clone ( ) ,
1403
1413
channels : vec ! ( NetworkMap :: get_key( 5 , zero_hash. clone( ) ) , NetworkMap :: get_key( 11 , zero_hash. clone( ) ) ) ,
1404
1414
lowest_inbound_channel_fee_base_msat : 0 ,
1405
1415
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1434,6 +1444,7 @@ mod tests {
1434
1444
announcement_message : None ,
1435
1445
} ) ;
1436
1446
network. nodes . insert ( node5. clone ( ) , NodeInfo {
1447
+ node_id : node5. clone ( ) ,
1437
1448
channels : vec ! ( NetworkMap :: get_key( 6 , zero_hash. clone( ) ) , NetworkMap :: get_key( 11 , zero_hash. clone( ) ) ) ,
1438
1449
lowest_inbound_channel_fee_base_msat : 0 ,
1439
1450
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1491,6 +1502,7 @@ mod tests {
1491
1502
announcement_message : None ,
1492
1503
} ) ;
1493
1504
network. nodes . insert ( node6. clone ( ) , NodeInfo {
1505
+ node_id : node6. clone ( ) ,
1494
1506
channels : vec ! ( NetworkMap :: get_key( 7 , zero_hash. clone( ) ) ) ,
1495
1507
lowest_inbound_channel_fee_base_msat : 0 ,
1496
1508
lowest_inbound_channel_fee_proportional_millionths : 0 ,
0 commit comments