From 3aa30c63ba4c748f4fab5f8d40b87a7a33db6e11 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Mon, 3 Oct 2022 23:25:44 +0100 Subject: [PATCH] Handle base64 encoded addresses in block check --- validators/validator.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/validators/validator.js b/validators/validator.js index a5a7382..141ca8b 100644 --- a/validators/validator.js +++ b/validators/validator.js @@ -1,6 +1,6 @@ import _ from 'lodash' import { - fromBase64, toHex, Bech32 + toBase64, fromBase64, toHex, fromHex, Bech32 } from '@cosmjs/encoding' import { sha256 } from '@cosmjs/crypto' import { multiply, divide, pow } from 'mathjs' @@ -107,16 +107,18 @@ export class Validator { missedBlocks(max){ const hexAddress = this.hexAddress() + const base64Address = toBase64(fromHex(hexAddress)) const blocks = this.blocks.filter(block => { - return !block.signatures.find(el => el === hexAddress) + return !block.signatures.find(el => [hexAddress, base64Address].includes(el)) }) return blocks.slice(0, max || blocks.length) } signedBlocks(max){ const hexAddress = this.hexAddress() + const base64Address = toBase64(fromHex(hexAddress)) const blocks = this.blocks.filter(block => { - return block.signatures.find(el => el === hexAddress) + return block.signatures.find(el => [hexAddress, base64Address].includes(el)) }) return blocks.slice(0, max || blocks.length) }