Skip to content

Commit

Permalink
Merge pull request #162 from skalenetwork/feature/SKALE-2472-is-accep…
Browse files Browse the repository at this point in the history
…ting-new-requests

SKALE-2472 Add is_accepting_new_requests function
  • Loading branch information
dmytrotkk authored May 6, 2020
2 parents 2e423cc + 365e64b commit 583fbb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions skale/contracts/delegation/validator_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions tests/contracts/delegation/validator_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 583fbb5

Please sign in to comment.