@@ -263,7 +263,8 @@ async fn test_trivial_setup() {
263
263
}
264
264
265
265
let delta = calculate_delta ( network_graph_arc. clone ( ) , 0 , None , logger. clone ( ) ) . await ;
266
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
266
+ let delta_time = timestamp % config:: snapshot_generation_interval ( ) ;
267
+ let serialization = serialize_delta ( & delta, delta_time, 1 , logger. clone ( ) ) ;
267
268
logger. assert_log_contains ( "rapid_gossip_sync_server" , "announcement channel count: 1" , 1 ) ;
268
269
clean_test_db ( ) . await ;
269
270
@@ -280,8 +281,7 @@ async fn test_trivial_setup() {
280
281
let update_result = rgs. update_network_graph ( & serialization. data ) . unwrap ( ) ;
281
282
println ! ( "update result: {}" , update_result) ;
282
283
// the update result must be a multiple of our snapshot granularity
283
- assert_eq ! ( update_result % config:: snapshot_generation_interval( ) , 0 ) ;
284
- assert ! ( update_result < timestamp) ;
284
+ assert_eq ! ( update_result, delta_time) ;
285
285
286
286
let timestamp_delta = timestamp - update_result;
287
287
println ! ( "timestamp delta: {}" , timestamp_delta) ;
@@ -428,7 +428,7 @@ async fn test_node_announcement_delta_detection() {
428
428
}
429
429
430
430
let delta = calculate_delta ( network_graph_arc. clone ( ) , timestamp - 5 , None , logger. clone ( ) ) . await ;
431
- let serialization = serialize_delta ( & delta, 2 , logger. clone ( ) ) ;
431
+ let serialization = serialize_delta ( & delta, timestamp , 2 , logger. clone ( ) ) ;
432
432
clean_test_db ( ) . await ;
433
433
434
434
assert_eq ! ( serialization. message_count, 3 ) ;
@@ -479,7 +479,7 @@ async fn test_unidirectional_intermediate_update_consideration() {
479
479
let rgs = RapidGossipSync :: new ( client_graph_arc. clone ( ) , logger. clone ( ) ) ;
480
480
481
481
let delta = calculate_delta ( network_graph_arc. clone ( ) , timestamp + 1 , None , logger. clone ( ) ) . await ;
482
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
482
+ let serialization = serialize_delta ( & delta, current_time ( ) , 1 , logger. clone ( ) ) ;
483
483
484
484
logger. assert_log_contains ( "rapid_gossip_sync_server::lookup" , "Fetched 1 update rows of the first update in a new direction" , 1 ) ;
485
485
logger. assert_log_contains ( "rapid_gossip_sync_server::lookup" , "Processed 1 reference rows" , 1 ) ;
@@ -547,7 +547,7 @@ async fn test_bidirectional_intermediate_update_consideration() {
547
547
assert_eq ! ( channel_count, 1 ) ;
548
548
549
549
let delta = calculate_delta ( network_graph_arc. clone ( ) , timestamp + 1 , None , logger. clone ( ) ) . await ;
550
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
550
+ let serialization = serialize_delta ( & delta, current_time ( ) , 1 , logger. clone ( ) ) ;
551
551
552
552
logger. assert_log_contains ( "rapid_gossip_sync_server::lookup" , "Fetched 0 update rows of the first update in a new direction" , 1 ) ;
553
553
logger. assert_log_contains ( "rapid_gossip_sync_server::lookup" , "Processed 2 reference rows" , 1 ) ;
@@ -631,7 +631,7 @@ async fn test_channel_reminders() {
631
631
assert_eq ! ( channel_count, 2 ) ;
632
632
633
633
let delta = calculate_delta ( network_graph_arc. clone ( ) , timestamp - channel_reminder_delta + 15 , None , logger. clone ( ) ) . await ;
634
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
634
+ let serialization = serialize_delta ( & delta, current_time ( ) , 1 , logger. clone ( ) ) ;
635
635
636
636
logger. assert_log_contains ( "rapid_gossip_sync_server::lookup" , "Fetched 0 update rows of the first update in a new direction" , 1 ) ;
637
637
logger. assert_log_contains ( "rapid_gossip_sync_server::lookup" , "Fetched 4 update rows of the latest update in the less recently updated direction" , 1 ) ;
@@ -701,7 +701,8 @@ async fn test_full_snapshot_recency() {
701
701
702
702
{ // sync after initial seed
703
703
let delta = calculate_delta ( network_graph_arc. clone ( ) , 0 , None , logger. clone ( ) ) . await ;
704
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
704
+ let delta_time = current_time ( ) % config:: snapshot_generation_interval ( ) ;
705
+ let serialization = serialize_delta ( & delta, current_time ( ) , 1 , logger. clone ( ) ) ;
705
706
logger. assert_log_contains ( "rapid_gossip_sync_server" , "announcement channel count: 1" , 1 ) ;
706
707
707
708
let channel_count = network_graph_arc. read_only ( ) . channels ( ) . len ( ) ;
@@ -714,8 +715,7 @@ async fn test_full_snapshot_recency() {
714
715
let rgs = RapidGossipSync :: new ( client_graph_arc. clone ( ) , logger. clone ( ) ) ;
715
716
let update_result = rgs. update_network_graph ( & serialization. data ) . unwrap ( ) ;
716
717
// the update result must be a multiple of our snapshot granularity
717
- assert_eq ! ( update_result % config:: snapshot_generation_interval( ) , 0 ) ;
718
- assert ! ( update_result < timestamp) ;
718
+ assert_eq ! ( update_result, delta_time) ;
719
719
720
720
let readonly_graph = client_graph_arc. read_only ( ) ;
721
721
let channels = readonly_graph. channels ( ) ;
@@ -782,7 +782,8 @@ async fn test_full_snapshot_recency_with_wrong_seen_order() {
782
782
783
783
{ // sync after initial seed
784
784
let delta = calculate_delta ( network_graph_arc. clone ( ) , 0 , None , logger. clone ( ) ) . await ;
785
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
785
+ let delta_time = current_time ( ) % config:: snapshot_generation_interval ( ) ;
786
+ let serialization = serialize_delta ( & delta, delta_time, 1 , logger. clone ( ) ) ;
786
787
logger. assert_log_contains ( "rapid_gossip_sync_server" , "announcement channel count: 1" , 1 ) ;
787
788
788
789
let channel_count = network_graph_arc. read_only ( ) . channels ( ) . len ( ) ;
@@ -795,8 +796,7 @@ async fn test_full_snapshot_recency_with_wrong_seen_order() {
795
796
let rgs = RapidGossipSync :: new ( client_graph_arc. clone ( ) , logger. clone ( ) ) ;
796
797
let update_result = rgs. update_network_graph ( & serialization. data ) . unwrap ( ) ;
797
798
// the update result must be a multiple of our snapshot granularity
798
- assert_eq ! ( update_result % config:: snapshot_generation_interval( ) , 0 ) ;
799
- assert ! ( update_result < timestamp) ;
799
+ assert_eq ! ( update_result, delta_time) ;
800
800
801
801
let readonly_graph = client_graph_arc. read_only ( ) ;
802
802
let channels = readonly_graph. channels ( ) ;
@@ -862,7 +862,8 @@ async fn test_full_snapshot_recency_with_wrong_propagation_order() {
862
862
863
863
{ // sync after initial seed
864
864
let delta = calculate_delta ( network_graph_arc. clone ( ) , 0 , None , logger. clone ( ) ) . await ;
865
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
865
+ let delta_time = current_time ( ) % config:: snapshot_generation_interval ( ) ;
866
+ let serialization = serialize_delta ( & delta, delta_time, 1 , logger. clone ( ) ) ;
866
867
logger. assert_log_contains ( "rapid_gossip_sync_server" , "announcement channel count: 1" , 1 ) ;
867
868
868
869
let channel_count = network_graph_arc. read_only ( ) . channels ( ) . len ( ) ;
@@ -875,8 +876,7 @@ async fn test_full_snapshot_recency_with_wrong_propagation_order() {
875
876
let rgs = RapidGossipSync :: new ( client_graph_arc. clone ( ) , logger. clone ( ) ) ;
876
877
let update_result = rgs. update_network_graph ( & serialization. data ) . unwrap ( ) ;
877
878
// the update result must be a multiple of our snapshot granularity
878
- assert_eq ! ( update_result % config:: snapshot_generation_interval( ) , 0 ) ;
879
- assert ! ( update_result < timestamp) ;
879
+ assert_eq ! ( update_result, delta_time) ;
880
880
881
881
let readonly_graph = client_graph_arc. read_only ( ) ;
882
882
let channels = readonly_graph. channels ( ) ;
@@ -996,7 +996,8 @@ async fn test_full_snapshot_mutiny_scenario() {
996
996
997
997
{ // sync after initial seed
998
998
let delta = calculate_delta ( network_graph_arc. clone ( ) , 0 , None , logger. clone ( ) ) . await ;
999
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
999
+ let delta_time = current_time ( ) % config:: snapshot_generation_interval ( ) ;
1000
+ let serialization = serialize_delta ( & delta, delta_time, 1 , logger. clone ( ) ) ;
1000
1001
logger. assert_log_contains ( "rapid_gossip_sync_server" , "announcement channel count: 1" , 1 ) ;
1001
1002
1002
1003
let channel_count = network_graph_arc. read_only ( ) . channels ( ) . len ( ) ;
@@ -1010,8 +1011,7 @@ async fn test_full_snapshot_mutiny_scenario() {
1010
1011
let update_result = rgs. update_network_graph ( & serialization. data ) . unwrap ( ) ;
1011
1012
println ! ( "update result: {}" , update_result) ;
1012
1013
// the update result must be a multiple of our snapshot granularity
1013
- assert_eq ! ( update_result % config:: snapshot_generation_interval( ) , 0 ) ;
1014
- assert ! ( update_result < timestamp) ;
1014
+ assert_eq ! ( update_result, delta_time) ;
1015
1015
1016
1016
let timestamp_delta = timestamp - update_result;
1017
1017
println ! ( "timestamp delta: {}" , timestamp_delta) ;
@@ -1110,7 +1110,8 @@ async fn test_full_snapshot_interlaced_channel_timestamps() {
1110
1110
1111
1111
{ // sync after initial seed
1112
1112
let delta = calculate_delta ( network_graph_arc. clone ( ) , 0 , None , logger. clone ( ) ) . await ;
1113
- let serialization = serialize_delta ( & delta, 1 , logger. clone ( ) ) ;
1113
+ let delta_time = current_time ( ) % config:: snapshot_generation_interval ( ) ;
1114
+ let serialization = serialize_delta ( & delta, delta_time, 1 , logger. clone ( ) ) ;
1114
1115
logger. assert_log_contains ( "rapid_gossip_sync_server" , "announcement channel count: 2" , 1 ) ;
1115
1116
1116
1117
let channel_count = network_graph_arc. read_only ( ) . channels ( ) . len ( ) ;
@@ -1123,8 +1124,7 @@ async fn test_full_snapshot_interlaced_channel_timestamps() {
1123
1124
let rgs = RapidGossipSync :: new ( client_graph_arc. clone ( ) , logger. clone ( ) ) ;
1124
1125
let update_result = rgs. update_network_graph ( & serialization. data ) . unwrap ( ) ;
1125
1126
// the update result must be a multiple of our snapshot granularity
1126
- assert_eq ! ( update_result % config:: snapshot_generation_interval( ) , 0 ) ;
1127
- assert ! ( update_result < timestamp) ;
1127
+ assert_eq ! ( update_result, delta_time) ;
1128
1128
1129
1129
let readonly_graph = client_graph_arc. read_only ( ) ;
1130
1130
let channels = readonly_graph. channels ( ) ;
0 commit comments