improve concensus and uptime

This commit is contained in:
liangping
2022-09-23 22:14:26 +08:00
parent 3dc24113e8
commit 1ff6568d74
3 changed files with 94 additions and 9 deletions
+3 -2
View File
@@ -195,12 +195,13 @@ export function consensusPubkeyToHexAddress(consensusPubkey) {
let raw = null
if (typeof consensusPubkey === 'object') {
if (consensusPubkey['@type'] === '/cosmos.crypto.ed25519.PubKey') {
raw = toBase64(fromHex(toHex(sha256(fromBase64(consensusPubkey.key))).slice(0, 40)))
// raw = toBase64(fromHex(toHex(sha256(fromBase64(consensusPubkey.key))).slice(0, 40)))
raw = toHex(sha256(fromBase64(consensusPubkey.key))).slice(0, 40).toUpperCase()
return raw
}
// /cosmos.crypto.secp256k1.PubKey
if (consensusPubkey['@type'] === '/cosmos.crypto.secp256k1.PubKey') {
raw = toBase64(fromHex(new RIPEMD160().update(Buffer.from(sha256(fromBase64(consensusPubkey.key)))).digest('hex')))
raw = new RIPEMD160().update(Buffer.from(sha256(fromBase64(consensusPubkey.key)))).digest('hex')
return raw
}
if (consensusPubkey.type === 'tendermint/PubKeySecp256k1') {