@@ -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
}
@@ -414,12 +414,15 @@ impl RoutingMessageHandler for Router {
414
414
match network. nodes . get_mut ( & msg. contents . node_id ) {
415
415
None => Err ( LightningError { err : "No existing channels for node_announcement" , action : ErrorAction :: IgnoreError } ) ,
416
416
Some ( node) => {
417
- if node. last_update >= msg. contents . timestamp {
418
- return Err ( LightningError { err : "Update older than last processed update" , action : ErrorAction :: IgnoreError } ) ;
417
+ match node. last_update {
418
+ Some ( last_update) => if last_update >= msg. contents . timestamp {
419
+ return Err ( LightningError { err : "Update older than last processed update" , action : ErrorAction :: IgnoreError } ) ;
420
+ } ,
421
+ None => { } ,
419
422
}
420
423
421
424
node. features = msg. contents . features . clone ( ) ;
422
- node. last_update = msg. contents . timestamp ;
425
+ node. last_update = Some ( msg. contents . timestamp ) ;
423
426
node. rgb = msg. contents . rgb ;
424
427
node. alias = msg. contents . alias ;
425
428
node. addresses = msg. contents . addresses . clone ( ) ;
@@ -535,7 +538,7 @@ impl RoutingMessageHandler for Router {
535
538
lowest_inbound_channel_fee_base_msat: u32 :: max_value( ) ,
536
539
lowest_inbound_channel_fee_proportional_millionths: u32 :: max_value( ) ,
537
540
features: NodeFeatures :: empty( ) ,
538
- last_update: 0 ,
541
+ last_update: None ,
539
542
rgb: [ 0 ; 3 ] ,
540
543
alias: [ 0 ; 32 ] ,
541
544
addresses: Vec :: new( ) ,
@@ -737,7 +740,7 @@ impl Router {
737
740
lowest_inbound_channel_fee_base_msat : u32:: max_value ( ) ,
738
741
lowest_inbound_channel_fee_proportional_millionths : u32:: max_value ( ) ,
739
742
features : NodeFeatures :: empty ( ) ,
740
- last_update : 0 ,
743
+ last_update : None ,
741
744
rgb : [ 0 ; 3 ] ,
742
745
alias : [ 0 ; 32 ] ,
743
746
addresses : Vec :: new ( ) ,
@@ -1153,7 +1156,7 @@ mod tests {
1153
1156
lowest_inbound_channel_fee_base_msat : 100 ,
1154
1157
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1155
1158
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 1 ) ) ,
1156
- last_update : 1 ,
1159
+ last_update : Some ( 1 ) ,
1157
1160
rgb : [ 0 ; 3 ] ,
1158
1161
alias : [ 0 ; 32 ] ,
1159
1162
addresses : Vec :: new ( ) ,
@@ -1187,7 +1190,7 @@ mod tests {
1187
1190
lowest_inbound_channel_fee_base_msat : 0 ,
1188
1191
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1189
1192
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 2 ) ) ,
1190
- last_update : 1 ,
1193
+ last_update : Some ( 1 ) ,
1191
1194
rgb : [ 0 ; 3 ] ,
1192
1195
alias : [ 0 ; 32 ] ,
1193
1196
addresses : Vec :: new ( ) ,
@@ -1221,7 +1224,7 @@ mod tests {
1221
1224
lowest_inbound_channel_fee_base_msat : 0 ,
1222
1225
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1223
1226
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 8 ) ) ,
1224
- last_update : 1 ,
1227
+ last_update : Some ( 1 ) ,
1225
1228
rgb : [ 0 ; 3 ] ,
1226
1229
alias : [ 0 ; 32 ] ,
1227
1230
addresses : Vec :: new ( ) ,
@@ -1261,7 +1264,7 @@ mod tests {
1261
1264
lowest_inbound_channel_fee_base_msat : 0 ,
1262
1265
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1263
1266
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 3 ) ) ,
1264
- last_update : 1 ,
1267
+ last_update : Some ( 1 ) ,
1265
1268
rgb : [ 0 ; 3 ] ,
1266
1269
alias : [ 0 ; 32 ] ,
1267
1270
addresses : Vec :: new ( ) ,
@@ -1341,7 +1344,7 @@ mod tests {
1341
1344
lowest_inbound_channel_fee_base_msat : 0 ,
1342
1345
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1343
1346
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 4 ) ) ,
1344
- last_update : 1 ,
1347
+ last_update : Some ( 1 ) ,
1345
1348
rgb : [ 0 ; 3 ] ,
1346
1349
alias : [ 0 ; 32 ] ,
1347
1350
addresses : Vec :: new ( ) ,
@@ -1375,7 +1378,7 @@ mod tests {
1375
1378
lowest_inbound_channel_fee_base_msat : 0 ,
1376
1379
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1377
1380
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 5 ) ) ,
1378
- last_update : 1 ,
1381
+ last_update : Some ( 1 ) ,
1379
1382
rgb : [ 0 ; 3 ] ,
1380
1383
alias : [ 0 ; 32 ] ,
1381
1384
addresses : Vec :: new ( ) ,
@@ -1432,7 +1435,7 @@ mod tests {
1432
1435
lowest_inbound_channel_fee_base_msat : 0 ,
1433
1436
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1434
1437
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 6 ) ) ,
1435
- last_update : 1 ,
1438
+ last_update : Some ( 1 ) ,
1436
1439
rgb : [ 0 ; 3 ] ,
1437
1440
alias : [ 0 ; 32 ] ,
1438
1441
addresses : Vec :: new ( ) ,
0 commit comments