Shuffle rpc endpoints

pull/3569/head
James Campbell 2024-12-11 16:18:10 +01:00
parent 456195a8c6
commit 25eec7314c
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import random
import time
from decimal import Decimal
from typing import Dict, List, Union
@ -168,8 +169,8 @@ def get_healthy_default_rpc_endpoints(domain: TACoDomain) -> Dict[int, List[str]
if not domain.is_testnet:
# iterate over all chains and filter out unhealthy endpoints
# only performed for mainnet for now since it would be inefficient
# on testnet where many more chains are/will be allowed
for chain_endpoints in endpoints.values():
random.shuffle(chain_endpoints)
healthy = {
chain_id: [
endpoint