Skip to content

Commit

Permalink
Handle validators with missing provider
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Feb 12, 2024
1 parent 85d4eba commit 3e51add
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions services/servicesMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,15 @@ function ServicesMonitor() {
}
}).json()
const providers = providerResponse.data.rewardOptions
const validators = await client.json.get('validators:' + chain.path, '$') || {}
const validators = await client.json.get('validators:' + chain.path, '$')
if(!validators?.validators) return

const calls = Object.entries(validators.validators).map(([address, validator]) => {
return async () => {
const assetProvider = providers.find(provider => {
return provider.validators.find(el => el.address === address)
})
if (assetProvider) {
if (assetProvider?.providers) {
const provider = assetProvider.providers[0]
await client.json.set('validators:' + chain.path, `$.validators.${address}.services`, {}, { NX: true });
await client.json.set('validators:' + chain.path, `$.validators.${address}.services.staking_rewards`, {
Expand Down

0 comments on commit 3e51add

Please sign in to comment.