From af372b0a06cfaa9a4db980771e81a7e3a525aad0 Mon Sep 17 00:00:00 2001 From: badrogger Date: Thu, 7 Mar 2024 18:10:12 +0000 Subject: [PATCH] Fix n value in wallets ima current node section --- core/schains/config/node_info.py | 6 ++++-- core/schains/config/skale_section.py | 1 + tests/schains/config/node_info_test.py | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/schains/config/node_info.py b/core/schains/config/node_info.py index b9ba6ce23..7af52aaaa 100644 --- a/core/schains/config/node_info.py +++ b/core/schains/config/node_info.py @@ -75,7 +75,9 @@ def to_dict(self): def generate_current_node_info( node: dict, node_id: int, ecdsa_key_name: str, static_node_info: dict, - schain: dict, schains_on_node: list, rotation_id: int, skale_manager_opts: SkaleManagerOpts, + schain: dict, schains_on_node: list, rotation_id: int, + nodes_in_schain: int, + skale_manager_opts: SkaleManagerOpts, sync_node: bool = False, archive: bool = False, catchup: bool = False ) -> CurrentNodeInfo: schain_base_port_on_node = get_schain_base_port_on_node( @@ -87,7 +89,7 @@ def generate_current_node_info( wallets = generate_wallets_config( schain['name'], rotation_id, - schain_nodes_number=len(schains_on_node), + schain_nodes_number=nodes_in_schain, sync_node=sync_node ) diff --git a/core/schains/config/skale_section.py b/core/schains/config/skale_section.py index badbe403d..b6fad2564 100644 --- a/core/schains/config/skale_section.py +++ b/core/schains/config/skale_section.py @@ -69,6 +69,7 @@ def generate_skale_section( schain=schain, schains_on_node=schains_on_node, rotation_id=rotation_id, + nodes_in_schain=len(schain_nodes_with_schains), skale_manager_opts=skale_manager_opts, sync_node=sync_node, archive=archive, diff --git a/tests/schains/config/node_info_test.py b/tests/schains/config/node_info_test.py index 5e9bb4d63..0e6e67eae 100644 --- a/tests/schains/config/node_info_test.py +++ b/tests/schains/config/node_info_test.py @@ -52,9 +52,11 @@ def test_generate_current_node_info( schain={'name': _schain_name, 'partOfNode': 0}, schains_on_node=[{'name': _schain_name, 'port': 10000}], rotation_id=0, + nodes_in_schain=5, skale_manager_opts=skale_manager_opts ) current_node_info_dict = current_node_info.to_dict() + assert current_node_info_dict['wallets']['ima']['n'] == 5 assert current_node_info_dict['nodeID'] == 1 assert current_node_info_dict['nodeName'] == 'test' assert current_node_info_dict['basePort'] == 10000 @@ -76,6 +78,7 @@ def test_generate_current_node_info( schain={'name': _schain_name, 'partOfNode': 0}, schains_on_node=[{'name': _schain_name, 'port': 10000}], rotation_id=0, + nodes_in_schain=4, skale_manager_opts=skale_manager_opts ) current_node_info_dict = current_node_info.to_dict() @@ -102,6 +105,7 @@ def test_skale_manager_opts( schain={'name': _schain_name, 'partOfNode': 0}, schains_on_node=[{'name': _schain_name, 'port': 10000}], rotation_id=0, + nodes_in_schain=4, skale_manager_opts=skale_manager_opts ) current_node_info_dict = current_node_info.to_dict()