@@ -155,7 +155,7 @@ struct NodeInfo {
155
155
lowest_inbound_channel_fee_proportional_millionths : u32 ,
156
156
157
157
features : NodeFeatures ,
158
- last_update : u32 ,
158
+ last_update : Option < u32 > ,
159
159
rgb : [ u8 ; 3 ] ,
160
160
alias : [ u8 ; 32 ] ,
161
161
addresses : Vec < NetAddress > ,
@@ -166,7 +166,7 @@ struct NodeInfo {
166
166
167
167
impl std:: fmt:: Display for NodeInfo {
168
168
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
169
- write ! ( f, "features: {}, last_update: {}, lowest_inbound_channel_fee_base_msat: {}, lowest_inbound_channel_fee_proportional_millionths: {}, channels: {:?}" , log_bytes!( self . features. encode( ) ) , self . last_update, self . lowest_inbound_channel_fee_base_msat, self . lowest_inbound_channel_fee_proportional_millionths, & self . channels[ ..] ) ?;
169
+ write ! ( f, "features: {}, last_update: {:? }, lowest_inbound_channel_fee_base_msat: {}, lowest_inbound_channel_fee_proportional_millionths: {}, channels: {:?}" , log_bytes!( self . features. encode( ) ) , self . last_update, self . lowest_inbound_channel_fee_base_msat, self . lowest_inbound_channel_fee_proportional_millionths, & self . channels[ ..] ) ?;
170
170
Ok ( ( ) )
171
171
}
172
172
}
@@ -429,12 +429,15 @@ impl RoutingMessageHandler for Router {
429
429
match network. nodes . get_mut ( & msg. contents . node_id ) {
430
430
None => Err ( LightningError { err : "No existing channels for node_announcement" , action : ErrorAction :: IgnoreError } ) ,
431
431
Some ( node) => {
432
- if node. last_update >= msg. contents . timestamp {
433
- return Err ( LightningError { err : "Update older than last processed update" , action : ErrorAction :: IgnoreError } ) ;
432
+ match node. last_update {
433
+ Some ( last_update) => if last_update >= msg. contents . timestamp {
434
+ return Err ( LightningError { err : "Update older than last processed update" , action : ErrorAction :: IgnoreError } ) ;
435
+ } ,
436
+ None => { } ,
434
437
}
435
438
436
439
node. features = msg. contents . features . clone ( ) ;
437
- node. last_update = msg. contents . timestamp ;
440
+ node. last_update = Some ( msg. contents . timestamp ) ;
438
441
node. rgb = msg. contents . rgb ;
439
442
node. alias = msg. contents . alias ;
440
443
node. addresses = msg. contents . addresses . clone ( ) ;
@@ -550,7 +553,7 @@ impl RoutingMessageHandler for Router {
550
553
lowest_inbound_channel_fee_base_msat: u32 :: max_value( ) ,
551
554
lowest_inbound_channel_fee_proportional_millionths: u32 :: max_value( ) ,
552
555
features: NodeFeatures :: empty( ) ,
553
- last_update: 0 ,
556
+ last_update: None ,
554
557
rgb: [ 0 ; 3 ] ,
555
558
alias: [ 0 ; 32 ] ,
556
559
addresses: Vec :: new( ) ,
@@ -752,7 +755,7 @@ impl Router {
752
755
lowest_inbound_channel_fee_base_msat : u32:: max_value ( ) ,
753
756
lowest_inbound_channel_fee_proportional_millionths : u32:: max_value ( ) ,
754
757
features : NodeFeatures :: empty ( ) ,
755
- last_update : 0 ,
758
+ last_update : None ,
756
759
rgb : [ 0 ; 3 ] ,
757
760
alias : [ 0 ; 32 ] ,
758
761
addresses : Vec :: new ( ) ,
@@ -1168,7 +1171,7 @@ mod tests {
1168
1171
lowest_inbound_channel_fee_base_msat : 100 ,
1169
1172
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1170
1173
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 1 ) ) ,
1171
- last_update : 1 ,
1174
+ last_update : Some ( 1 ) ,
1172
1175
rgb : [ 0 ; 3 ] ,
1173
1176
alias : [ 0 ; 32 ] ,
1174
1177
addresses : Vec :: new ( ) ,
@@ -1202,7 +1205,7 @@ mod tests {
1202
1205
lowest_inbound_channel_fee_base_msat : 0 ,
1203
1206
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1204
1207
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 2 ) ) ,
1205
- last_update : 1 ,
1208
+ last_update : Some ( 1 ) ,
1206
1209
rgb : [ 0 ; 3 ] ,
1207
1210
alias : [ 0 ; 32 ] ,
1208
1211
addresses : Vec :: new ( ) ,
@@ -1236,7 +1239,7 @@ mod tests {
1236
1239
lowest_inbound_channel_fee_base_msat : 0 ,
1237
1240
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1238
1241
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 8 ) ) ,
1239
- last_update : 1 ,
1242
+ last_update : Some ( 1 ) ,
1240
1243
rgb : [ 0 ; 3 ] ,
1241
1244
alias : [ 0 ; 32 ] ,
1242
1245
addresses : Vec :: new ( ) ,
@@ -1276,7 +1279,7 @@ mod tests {
1276
1279
lowest_inbound_channel_fee_base_msat : 0 ,
1277
1280
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1278
1281
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 3 ) ) ,
1279
- last_update : 1 ,
1282
+ last_update : Some ( 1 ) ,
1280
1283
rgb : [ 0 ; 3 ] ,
1281
1284
alias : [ 0 ; 32 ] ,
1282
1285
addresses : Vec :: new ( ) ,
@@ -1356,7 +1359,7 @@ mod tests {
1356
1359
lowest_inbound_channel_fee_base_msat : 0 ,
1357
1360
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1358
1361
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 4 ) ) ,
1359
- last_update : 1 ,
1362
+ last_update : Some ( 1 ) ,
1360
1363
rgb : [ 0 ; 3 ] ,
1361
1364
alias : [ 0 ; 32 ] ,
1362
1365
addresses : Vec :: new ( ) ,
@@ -1390,7 +1393,7 @@ mod tests {
1390
1393
lowest_inbound_channel_fee_base_msat : 0 ,
1391
1394
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1392
1395
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 5 ) ) ,
1393
- last_update : 1 ,
1396
+ last_update : Some ( 1 ) ,
1394
1397
rgb : [ 0 ; 3 ] ,
1395
1398
alias : [ 0 ; 32 ] ,
1396
1399
addresses : Vec :: new ( ) ,
@@ -1447,7 +1450,7 @@ mod tests {
1447
1450
lowest_inbound_channel_fee_base_msat : 0 ,
1448
1451
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1449
1452
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 6 ) ) ,
1450
- last_update : 1 ,
1453
+ last_update : Some ( 1 ) ,
1451
1454
rgb : [ 0 ; 3 ] ,
1452
1455
alias : [ 0 ; 32 ] ,
1453
1456
addresses : Vec :: new ( ) ,
0 commit comments