From b78f263b4c143c3056bb1ad8466a75216a86b4c6 Mon Sep 17 00:00:00 2001 From: derekpierre Date: Wed, 21 Aug 2024 16:51:21 -0400 Subject: [PATCH] On testnet /get_ursulas is used and its response format is slightly different than /bucket_sampling used on mainnet. --- deployment/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deployment/utils.py b/deployment/utils.py index 9ebf7048..8bba053b 100644 --- a/deployment/utils.py +++ b/deployment/utils.py @@ -195,6 +195,11 @@ def sample_nodes( response.raise_for_status() data = response.json() - result = sorted(data["result"]["ursulas"], key=lambda x: x.lower()) + ursulas = data["result"]["ursulas"] + if domain != MAINNET: + # /get_ursulas is used for sampling (instead of /bucket_sampling) + # so the json returned is slightly different + ursulas = [u["checksum_address"] for u in ursulas] + result = sorted(ursulas, key=lambda x: x.lower()) return result