From accc3b6144d2ea859595d343dad3cf1c634df126 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Mas=C5=82owski?= <rmaslowski@syncad.com>
Date: Mon, 25 Nov 2024 15:05:17 +0100
Subject: [PATCH] Refactor wax and node version verification in legacy mode

---
 package/test_tools/__private/wallet/wallet.py | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/package/test_tools/__private/wallet/wallet.py b/package/test_tools/__private/wallet/wallet.py
index de57d5d45..9e51fe865 100644
--- a/package/test_tools/__private/wallet/wallet.py
+++ b/package/test_tools/__private/wallet/wallet.py
@@ -77,12 +77,20 @@ class Wallet(UserHandleImplementation, ScopedObject):
         self._transaction_expiration_offset = timedelta(seconds=30)
         self.__prepare_directory()
         self.run(preconfigure=preconfigure)
-        if (
-            self.connected_node is not None
-            and self._transaction_serialization == "legacy"
-            and self.connected_node.api.database.get_version().node_type == "testnet"
-        ):
-            warnings.warn("Wallet in legacy mode may not work correctly with the testnet hive instance.", stacklevel=1)
+        if self.connected_node is not None:
+            node_version = self.connected_node.api.database.get_version().node_type
+            is_testnet_wax = wax_helpy.get_hive_protocol_config("hive.fund", self.__get_chain_id())["IS_TEST_NET"]
+            if self._transaction_serialization == "legacy":
+                if node_version == "testnet" and is_testnet_wax == "false":
+                    warnings.warn(
+                        "Wallet in legacy mode may not work correctly with the testnet hive instance and wax mainnet instance.",
+                        stacklevel=1,
+                    )
+                elif node_version == "mainnet" and is_testnet_wax == "true":
+                    warnings.warn(
+                        "Wallet in legacy mode may not work correctly with the mainnet hive instance and wax testnet instance.",
+                        stacklevel=1,
+                    )
 
     @property
     def _force_connected_node(self) -> AnyNode:
-- 
GitLab