update missing count in a fixed period

This commit is contained in:
liangping 2022-11-29 13:24:54 +08:00
parent 3425b8eb8c
commit b646c4a76b

View File

@ -283,19 +283,11 @@ export default {
if (cached) { if (cached) {
this.validators = cached this.validators = cached
} }
this.fetchMissingInfo()
this.$http.getValidatorList().then(res => { this.$http.getValidatorList().then(res => {
this.validators = res this.validators = res
}) })
this.$http.getSlashingSigningInfo().then(res => {
if (res.info) {
res.info.forEach(x => {
if (x.address) {
const hex = toBase64(fromBech32(x.address).data)
this.missing[hex] = x
}
})
}
})
this.initBlocks() this.initBlocks()
}, },
beforeDestroy() { beforeDestroy() {
@ -304,6 +296,18 @@ export default {
clearInterval(this.timer) clearInterval(this.timer)
}, },
methods: { methods: {
fetchMissingInfo() {
this.$http.getSlashingSigningInfo().then(res => {
if (res.info) {
res.info.forEach(x => {
if (x.address) {
const hex = toBase64(fromBech32(x.address).data)
this.missing[hex] = x
}
})
}
})
},
pinValidator() { pinValidator() {
localStorage.setItem('pinned', this.pinned) localStorage.setItem('pinned', this.pinned)
}, },
@ -387,6 +391,9 @@ export default {
if (x.validator_address) sigs[x.validator_address] = 'bg-success' if (x.validator_address) sigs[x.validator_address] = 'bg-success'
}) })
this.height = res.block.header.height this.height = res.block.header.height
if (Number(this.height) % 100 === 0) { // update the missing number each 100
this.fetchMissingInfo()
}
const block = this.blocks.find(b => b.height === res.block.last_commit.height) const block = this.blocks.find(b => b.height === res.block.last_commit.height)
if (typeof block === 'undefined') { // mei if (typeof block === 'undefined') { // mei
// this.$set(block, 0, typeof sigs !== 'undefined') // this.$set(block, 0, typeof sigs !== 'undefined')