From a7dc1c7da9db9612b7bd3a8bfdb67cbc9aac8a56 Mon Sep 17 00:00:00 2001 From: Dmytro Tkachuk Date: Wed, 6 May 2020 15:04:00 +0300 Subject: [PATCH] SKALE-2472 Add is_accepting_new_requests function --- skale/contracts/delegation/validator_service.py | 4 ++++ tests/contracts/delegation/validator_service_test.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/skale/contracts/delegation/validator_service.py b/skale/contracts/delegation/validator_service.py index 291f0ef2..1c23caa0 100644 --- a/skale/contracts/delegation/validator_service.py +++ b/skale/contracts/delegation/validator_service.py @@ -171,6 +171,10 @@ def _is_validator_trusted(self, validator_id: int) -> bool: """For internal usage only""" return self.contract.functions.trustedValidators(validator_id).call() + def is_accepting_new_requests(self, validator_id: int) -> bool: + """For internal usage only""" + return self.contract.functions.isAcceptingNewRequests(validator_id).call() + @transaction_method(GAS['register_validator']) def register_validator(self, name: str, description: str, fee_rate: int, min_delegation_amount: int) -> TxRes: diff --git a/tests/contracts/delegation/validator_service_test.py b/tests/contracts/delegation/validator_service_test.py index 4957db81..3a4c3c5c 100644 --- a/tests/contracts/delegation/validator_service_test.py +++ b/tests/contracts/delegation/validator_service_test.py @@ -178,6 +178,11 @@ def test_is_validator_trusted(skale): assert is_validator_trusted +def test_is_accepting_new_requests(skale): + is_accepting_new_requests = skale.validator_service.is_accepting_new_requests(D_VALIDATOR_ID) + assert is_accepting_new_requests + + def test_register_existing_validator(skale): with pytest.raises(TransactionFailedError): skale.validator_service.register_validator(