@@ -63,11 +63,12 @@ def simulate_time_pass(seconds):
6363 current_time += seconds
6464 return current_time
6565
66- def setup_check (state , stall_time_limit , max_slot_distance ):
66+ def setup_check (state , stall_time_limit , abandoned_time_limit , max_slot_distance ):
6767 check = PublisherStalledCheck (
6868 state ,
6969 {
7070 "stall_time_limit" : stall_time_limit ,
71+ "abandoned_time_limit" : abandoned_time_limit ,
7172 "max_slot_distance" : max_slot_distance ,
7273 },
7374 )
@@ -83,17 +84,17 @@ def run_check(check, seconds, expected):
8384
8485 PUBLISHER_CACHE .clear ()
8586 state_a = make_state (1 , 100.0 , 2.0 , 1 , 100.0 , 1.0 )
86- check_a = setup_check (state_a , 5 , 25 )
87+ check_a = setup_check (state_a , 5 , 25 , 25 )
8788 run_check (check_a , 5 , True ) # Should pass as it hits the limit exactly
8889
8990 PUBLISHER_CACHE .clear ()
9091 state_b = make_state (1 , 100.0 , 2.0 , 1 , 100.0 , 1.0 )
91- check_b = setup_check (state_b , 5 , 25 )
92+ check_b = setup_check (state_b , 5 , 25 , 25 )
9293 run_check (check_b , 6 , False ) # Should fail as it exceeds the limit
9394
9495 PUBLISHER_CACHE .clear ()
9596 state_c = make_state (1 , 100.0 , 2.0 , 1 , 100.0 , 1.0 )
96- check_c = setup_check (state_c , 5 , 25 )
97+ check_c = setup_check (state_c , 5 , 25 , 25 )
9798 run_check (check_c , 2 , True ) # Initial check should pass
9899 state_c .price = 105.0 # Change the price
99100 run_check (check_c , 3 , True ) # Should pass as price changes
@@ -108,5 +109,5 @@ def run_check(check, seconds, expected):
108109 state_d = make_state (1 , 100.0 , 2.0 , 1 , 100.0 , 1.0 )
109110 state_d .latest_block_slot = 25
110111 state_d .slot = 0
111- check_d = setup_check (state_d , 5 , 25 )
112+ check_d = setup_check (state_d , 5 , 25 , 25 )
112113 run_check (check_d , 10 , True ) # Should pass as the publisher is offline
0 commit comments