Skip to content

Commit

Permalink
Handle unmatched on-chain validator
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Jun 15, 2022
1 parent e01a2cd commit 8f7ea63
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 8f7ea63

Please sign in to comment.