From f4dda3c1f3d66ec3301b4309aa52e6e865c25e73 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 28 Dec 2023 12:32:46 +0800 Subject: [PATCH] trigger update signing info --- src/modules/[chain]/uptime/index.vue | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/modules/[chain]/uptime/index.vue b/src/modules/[chain]/uptime/index.vue index 6ad6a77f..81a80a8f 100644 --- a/src/modules/[chain]/uptime/index.vue +++ b/src/modules/[chain]/uptime/index.vue @@ -10,6 +10,7 @@ import { import UptimeBar from '@/components/UptimeBar.vue'; import type { Commit, SlashingParam, SigningInfo } from '@/types'; import { consensusPubkeyToHexAddress, pubKeyToValcons, valconsToBase64 } from '@/libs'; +import { lazyKeyElSetMap } from 'lazy-load-vue3/types/listen'; const props = defineProps(['chain']); @@ -107,19 +108,27 @@ onMounted(() => { } }); - chainStore.rpc.getSlashingSigningInfos().then((x) => { - x.info?.forEach((i) => { - signingInfo.value[valconsToBase64(i.address)] = i; - }); - }); + updateTotalSigningInfo(); chainStore.rpc.getSlashingParams().then((x) => { slashingParam.value = x.params; }); }); +function updateTotalSigningInfo() { + chainStore.rpc.getSlashingSigningInfos().then((x) => { + x.info?.forEach((i) => { + signingInfo.value[valconsToBase64(i.address)] = i; + }); + }); +} + const commits2 = computed(() => { const la = baseStore.recents.map((b) => b.block.last_commit); + // trigger update total signing info + if(la.length > 0 && la.at(0)?.height|| 0 % 7 === 0) { + updateTotalSigningInfo(); + }; const all = [...commits.value, ...la]; return all.length > 50 ? all.slice(all.length - 50) : all; });