Skip to content

Commit

Permalink
Merge pull request #19 from eco-stake/handle-no-on-chain-validator
Browse files Browse the repository at this point in the history
Handle unmatched on-chain validator
  • Loading branch information
tombeynon authored Jun 15, 2022
2 parents e01a2cd + 8f7ea63 commit 604c007
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions validators/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
fromBase64, toHex
} from '@cosmjs/encoding'
import { sha256 } from '@cosmjs/crypto'
import RIPEMD160 from 'ripemd160'

export class Validator {
constructor(data, registryData, blocks){
Expand All @@ -16,9 +15,11 @@ export class Validator {

hexAddress(){
const pubKey = this.data.consensus_pubkey
const raw = sha256(fromBase64(pubKey.key))
const address = toHex(raw).slice(0, 40).toUpperCase()
return address
if(pubKey){
const raw = sha256(fromBase64(pubKey.key))
const address = toHex(raw).slice(0, 40).toUpperCase()
return address
}
}

uptimePercentage(){
Expand Down

0 comments on commit 604c007

Please sign in to comment.