@@ -156,7 +156,7 @@ struct NodeInfo {
156
156
lowest_inbound_channel_fee_proportional_millionths : u32 ,
157
157
158
158
features : NodeFeatures ,
159
- last_update : u32 ,
159
+ last_update : Option < u32 > ,
160
160
rgb : [ u8 ; 3 ] ,
161
161
alias : [ u8 ; 32 ] ,
162
162
addresses : Vec < NetAddress > ,
@@ -167,7 +167,7 @@ struct NodeInfo {
167
167
168
168
impl std:: fmt:: Display for NodeInfo {
169
169
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
170
- 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
+ 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[ ..] ) ?;
171
171
Ok ( ( ) )
172
172
}
173
173
}
@@ -418,12 +418,15 @@ impl RoutingMessageHandler for Router {
418
418
match network. nodes . get_mut ( & msg. contents . node_id ) {
419
419
None => Err ( LightningError { err : "No existing channels for node_announcement" , action : ErrorAction :: IgnoreError } ) ,
420
420
Some ( node) => {
421
- if node. last_update >= msg. contents . timestamp {
422
- return Err ( LightningError { err : "Update older than last processed update" , action : ErrorAction :: IgnoreError } ) ;
421
+ match node. last_update {
422
+ Some ( last_update) => if last_update >= msg. contents . timestamp {
423
+ return Err ( LightningError { err : "Update older than last processed update" , action : ErrorAction :: IgnoreError } ) ;
424
+ } ,
425
+ None => { } ,
423
426
}
424
427
425
428
node. features = msg. contents . features . clone ( ) ;
426
- node. last_update = msg. contents . timestamp ;
429
+ node. last_update = Some ( msg. contents . timestamp ) ;
427
430
node. rgb = msg. contents . rgb ;
428
431
node. alias = msg. contents . alias ;
429
432
node. addresses = msg. contents . addresses . clone ( ) ;
@@ -539,7 +542,7 @@ impl RoutingMessageHandler for Router {
539
542
lowest_inbound_channel_fee_base_msat: u32 :: max_value( ) ,
540
543
lowest_inbound_channel_fee_proportional_millionths: u32 :: max_value( ) ,
541
544
features: NodeFeatures :: empty( ) ,
542
- last_update: 0 ,
545
+ last_update: None ,
543
546
rgb: [ 0 ; 3 ] ,
544
547
alias: [ 0 ; 32 ] ,
545
548
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 ( ) ,
@@ -1175,7 +1178,7 @@ mod tests {
1175
1178
lowest_inbound_channel_fee_base_msat : 100 ,
1176
1179
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1177
1180
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 1 ) ) ,
1178
- last_update : 1 ,
1181
+ last_update : Some ( 1 ) ,
1179
1182
rgb : [ 0 ; 3 ] ,
1180
1183
alias : [ 0 ; 32 ] ,
1181
1184
addresses : Vec :: new ( ) ,
@@ -1209,7 +1212,7 @@ mod tests {
1209
1212
lowest_inbound_channel_fee_base_msat : 0 ,
1210
1213
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1211
1214
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 2 ) ) ,
1212
- last_update : 1 ,
1215
+ last_update : Some ( 1 ) ,
1213
1216
rgb : [ 0 ; 3 ] ,
1214
1217
alias : [ 0 ; 32 ] ,
1215
1218
addresses : Vec :: new ( ) ,
@@ -1243,7 +1246,7 @@ mod tests {
1243
1246
lowest_inbound_channel_fee_base_msat : 0 ,
1244
1247
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1245
1248
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 8 ) ) ,
1246
- last_update : 1 ,
1249
+ last_update : Some ( 1 ) ,
1247
1250
rgb : [ 0 ; 3 ] ,
1248
1251
alias : [ 0 ; 32 ] ,
1249
1252
addresses : Vec :: new ( ) ,
@@ -1283,7 +1286,7 @@ mod tests {
1283
1286
lowest_inbound_channel_fee_base_msat : 0 ,
1284
1287
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1285
1288
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 3 ) ) ,
1286
- last_update : 1 ,
1289
+ last_update : Some ( 1 ) ,
1287
1290
rgb : [ 0 ; 3 ] ,
1288
1291
alias : [ 0 ; 32 ] ,
1289
1292
addresses : Vec :: new ( ) ,
@@ -1363,7 +1366,7 @@ mod tests {
1363
1366
lowest_inbound_channel_fee_base_msat : 0 ,
1364
1367
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1365
1368
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 4 ) ) ,
1366
- last_update : 1 ,
1369
+ last_update : Some ( 1 ) ,
1367
1370
rgb : [ 0 ; 3 ] ,
1368
1371
alias : [ 0 ; 32 ] ,
1369
1372
addresses : Vec :: new ( ) ,
@@ -1397,7 +1400,7 @@ mod tests {
1397
1400
lowest_inbound_channel_fee_base_msat : 0 ,
1398
1401
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1399
1402
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 5 ) ) ,
1400
- last_update : 1 ,
1403
+ last_update : Some ( 1 ) ,
1401
1404
rgb : [ 0 ; 3 ] ,
1402
1405
alias : [ 0 ; 32 ] ,
1403
1406
addresses : Vec :: new ( ) ,
@@ -1454,7 +1457,7 @@ mod tests {
1454
1457
lowest_inbound_channel_fee_base_msat : 0 ,
1455
1458
lowest_inbound_channel_fee_proportional_millionths : 0 ,
1456
1459
features : NodeFeatures :: from_le_bytes ( id_to_feature_flags ! ( 6 ) ) ,
1457
- last_update : 1 ,
1460
+ last_update : Some ( 1 ) ,
1458
1461
rgb : [ 0 ; 3 ] ,
1459
1462
alias : [ 0 ; 32 ] ,
1460
1463
addresses : Vec :: new ( ) ,
0 commit comments