@@ -63,11 +63,12 @@ def simulate_time_pass(seconds):
63
63
current_time += seconds
64
64
return current_time
65
65
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 ):
67
67
check = PublisherStalledCheck (
68
68
state ,
69
69
{
70
70
"stall_time_limit" : stall_time_limit ,
71
+ "abandoned_time_limit" : abandoned_time_limit ,
71
72
"max_slot_distance" : max_slot_distance ,
72
73
},
73
74
)
@@ -83,17 +84,17 @@ def run_check(check, seconds, expected):
83
84
84
85
PUBLISHER_CACHE .clear ()
85
86
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 )
87
88
run_check (check_a , 5 , True ) # Should pass as it hits the limit exactly
88
89
89
90
PUBLISHER_CACHE .clear ()
90
91
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 )
92
93
run_check (check_b , 6 , False ) # Should fail as it exceeds the limit
93
94
94
95
PUBLISHER_CACHE .clear ()
95
96
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 )
97
98
run_check (check_c , 2 , True ) # Initial check should pass
98
99
state_c .price = 105.0 # Change the price
99
100
run_check (check_c , 3 , True ) # Should pass as price changes
@@ -108,5 +109,5 @@ def run_check(check, seconds, expected):
108
109
state_d = make_state (1 , 100.0 , 2.0 , 1 , 100.0 , 1.0 )
109
110
state_d .latest_block_slot = 25
110
111
state_d .slot = 0
111
- check_d = setup_check (state_d , 5 , 25 )
112
+ check_d = setup_check (state_d , 5 , 25 , 25 )
112
113
run_check (check_d , 10 , True ) # Should pass as the publisher is offline
0 commit comments