Skip to content

Commit f4a0b5e

Browse files
committed
fix rate limits test
1 parent 9d735e9 commit f4a0b5e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

chia/_tests/core/server/test_rate_limits.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
rl_v2 = [Capability.BASE, Capability.BLOCK_HEADERS, Capability.RATE_LIMITS_V2]
2525
rl_v1 = [Capability.BASE]
2626
node_with_params_b = node_with_params
27-
test_different_versions_results: list[int] = []
2827

2928

3029
@dataclass
@@ -418,11 +417,14 @@ async def test_different_versions(
418417
# The following code checks whether all of the runs resulted in the same number of items in "rate_limits_tx",
419418
# which would mean the same rate limits are always used. This should not happen, since two nodes with V2
420419
# will use V2.
421-
total_tx_msg_count = len(get_rate_limits_to_use(a_con.local_capabilities, a_con.peer_capabilities))
420+
rate_limits = get_rate_limits_to_use(a_con.local_capabilities, a_con.peer_capabilities)[0]
421+
limit = rate_limits[ProtocolMessageTypes.request_header_blocks]
422+
assert isinstance(limit, RLSettings)
422423

423-
test_different_versions_results.append(total_tx_msg_count)
424-
if len(test_different_versions_results) >= 4:
425-
assert len(set(test_different_versions_results)) >= 2
424+
if Capability.RATE_LIMITS_V2 in a_con.local_capabilities and Capability.RATE_LIMITS_V2 in a_con.peer_capabilities:
425+
assert limit.frequency == 5000
426+
else:
427+
assert limit.frequency == 500
426428

427429

428430
@pytest.mark.anyio

0 commit comments

Comments
 (0)