diff --git a/skale/contracts/delegation/validator_service.py b/skale/contracts/delegation/validator_service.py index b0549ed9..d4c188d5 100644 --- a/skale/contracts/delegation/validator_service.py +++ b/skale/contracts/delegation/validator_service.py @@ -138,6 +138,14 @@ def get_trusted_validator_ids(self) -> list: """ return self.contract.functions.getTrustedValidators().call() + def get_validator_node_indices(self, validator_id: int) -> list: + """Returns list of node indices to the validator + + :returns: List of trusted node indices + :rtype: list + """ + return self.contract.functions.getValidatorNodeIndexes(validator_id).call() + @transaction_method def _enable_validator(self, validator_id: int) -> TxRes: """For internal usage only""" diff --git a/tests/contracts/delegation/validator_service_test.py b/tests/contracts/delegation/validator_service_test.py index f4679ab2..abfa0b60 100644 --- a/tests/contracts/delegation/validator_service_test.py +++ b/tests/contracts/delegation/validator_service_test.py @@ -97,6 +97,14 @@ def test_validator_id_by_address(skale): assert validator_id == D_VALIDATOR_ID +def test_get_validator_node_indices(skale): + node_indices = skale.validator_service.get_validator_node_indices( + validator_id=D_VALIDATOR_ID + ) + assert 0 in node_indices + assert 1 in node_indices + + def test_enable_validator(skale): _generate_new_validator(skale) latest_id = skale.validator_service.number_of_validators()