trigger update signing info

This commit is contained in:
liangping 2023-12-28 12:32:46 +08:00
parent 5ecba3b283
commit f4dda3c1f3

View File

@ -10,6 +10,7 @@ import {
import UptimeBar from '@/components/UptimeBar.vue'; import UptimeBar from '@/components/UptimeBar.vue';
import type { Commit, SlashingParam, SigningInfo } from '@/types'; import type { Commit, SlashingParam, SigningInfo } from '@/types';
import { consensusPubkeyToHexAddress, pubKeyToValcons, valconsToBase64 } from '@/libs'; import { consensusPubkeyToHexAddress, pubKeyToValcons, valconsToBase64 } from '@/libs';
import { lazyKeyElSetMap } from 'lazy-load-vue3/types/listen';
const props = defineProps(['chain']); const props = defineProps(['chain']);
@ -107,19 +108,27 @@ onMounted(() => {
} }
}); });
chainStore.rpc.getSlashingSigningInfos().then((x) => { updateTotalSigningInfo();
x.info?.forEach((i) => {
signingInfo.value[valconsToBase64(i.address)] = i;
});
});
chainStore.rpc.getSlashingParams().then((x) => { chainStore.rpc.getSlashingParams().then((x) => {
slashingParam.value = x.params; 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 commits2 = computed(() => {
const la = baseStore.recents.map((b) => b.block.last_commit); 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]; const all = [...commits.value, ...la];
return all.length > 50 ? all.slice(all.length - 50) : all; return all.length > 50 ? all.slice(all.length - 50) : all;
}); });