Skip to content

Commit

Permalink
Delay get_oracles
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-stakewise committed Oct 31, 2023
1 parent 6176707 commit 75a3e6d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/validators/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,19 @@ async def register_validators(

metrics.stakeable_assets.set(int(vault_balance))

# get latest oracles
oracles = await get_oracles()
logger.debug('Fetched latest oracles: %s', oracles)

approval_max_validators = oracles.validators_approval_batch_limit

# calculate number of validators that can be registered
validators_count: int = min(approval_max_validators, vault_balance // DEPOSIT_AMOUNT)
validators_count = vault_balance // DEPOSIT_AMOUNT
if not validators_count:
# not enough balance to register validators
return

# get latest oracles
oracles = await get_oracles()
logger.info('Fetched latest oracles: %s', oracles)

approval_max_validators = oracles.validators_approval_batch_limit
validators_count = min(approval_max_validators, validators_count)

if not await check_gas_price():
return

Expand Down

0 comments on commit 75a3e6d

Please sign in to comment.