@@ -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 ,
@@ -1247,6 +1253,7 @@ mod tests {
1247
1253
announcement_message : None ,
1248
1254
} ) ;
1249
1255
network. nodes . insert ( node2. clone ( ) , NodeInfo {
1256
+ node_id : node2. clone ( ) ,
1250
1257
channels : vec ! ( NetworkMap :: get_key( 2 , zero_hash. clone( ) ) , NetworkMap :: get_key( 4 , zero_hash. clone( ) ) ) ,
1251
1258
lowest_inbound_channel_fee_base_msat : 0 ,
1252
1259
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1282,6 +1289,7 @@ mod tests {
1282
1289
announcement_message : None ,
1283
1290
} ) ;
1284
1291
network. nodes . insert ( node8. clone ( ) , NodeInfo {
1292
+ node_id : node8. clone ( ) ,
1285
1293
channels : vec ! ( NetworkMap :: get_key( 12 , zero_hash. clone( ) ) , NetworkMap :: get_key( 13 , zero_hash. clone( ) ) ) ,
1286
1294
lowest_inbound_channel_fee_base_msat : 0 ,
1287
1295
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1317,6 +1325,7 @@ mod tests {
1317
1325
announcement_message : None ,
1318
1326
} ) ;
1319
1327
network. nodes . insert ( node3. clone ( ) , NodeInfo {
1328
+ node_id : node3. clone ( ) ,
1320
1329
channels : vec ! (
1321
1330
NetworkMap :: get_key( 3 , zero_hash. clone( ) ) ,
1322
1331
NetworkMap :: get_key( 4 , zero_hash. clone( ) ) ,
@@ -1406,6 +1415,7 @@ mod tests {
1406
1415
announcement_message : None ,
1407
1416
} ) ;
1408
1417
network. nodes . insert ( node4. clone ( ) , NodeInfo {
1418
+ node_id : node4. clone ( ) ,
1409
1419
channels : vec ! ( NetworkMap :: get_key( 5 , zero_hash. clone( ) ) , NetworkMap :: get_key( 11 , zero_hash. clone( ) ) ) ,
1410
1420
lowest_inbound_channel_fee_base_msat : 0 ,
1411
1421
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1441,6 +1451,7 @@ mod tests {
1441
1451
announcement_message : None ,
1442
1452
} ) ;
1443
1453
network. nodes . insert ( node5. clone ( ) , NodeInfo {
1454
+ node_id : node5. clone ( ) ,
1444
1455
channels : vec ! ( NetworkMap :: get_key( 6 , zero_hash. clone( ) ) , NetworkMap :: get_key( 11 , zero_hash. clone( ) ) ) ,
1445
1456
lowest_inbound_channel_fee_base_msat : 0 ,
1446
1457
lowest_inbound_channel_fee_proportional_millionths : 0 ,
@@ -1500,6 +1511,7 @@ mod tests {
1500
1511
announcement_message : None ,
1501
1512
} ) ;
1502
1513
network. nodes . insert ( node6. clone ( ) , NodeInfo {
1514
+ node_id : node6. clone ( ) ,
1503
1515
channels : vec ! ( NetworkMap :: get_key( 7 , zero_hash. clone( ) ) ) ,
1504
1516
lowest_inbound_channel_fee_base_msat : 0 ,
1505
1517
lowest_inbound_channel_fee_proportional_millionths : 0 ,
0 commit comments