diff --git a/src/modules/[chain]/statesync/index.vue b/src/modules/[chain]/statesync/index.vue index 69cc5cb3..3878ede2 100644 --- a/src/modules/[chain]/statesync/index.vue +++ b/src/modules/[chain]/statesync/index.vue @@ -10,15 +10,20 @@ const blockchain = useBlockchain(); const base = useBaseStore(); const nodeInfo = ref({} as NodeInfo); -const height = ref(Number(base.latest.block?.header?.height|| 2001)) +const height = ref(0) const hash = ref("") -if(height.value > 2000) { - height.value = Math.round((height.value - 2000) / 1000) * 1000 - base.fetchBlock(height.value).then(res => { - hash.value = toHex(fromBase64(res.block_id.hash)).toUpperCase() - }) -} +base.$subscribe((m, { latest }) => { + let h = Number(latest.block?.header?.height) + h = Math.round((h - 2000) / 1000) * 1000 + if (h > height.value) { + height.value = h + base.fetchBlock(h).then(res => { + hash.value = toHex(fromBase64(res.block_id.hash)).toUpperCase() + }) + } +}) + const rpcs = computed(() => { return blockchain.current?.endpoints?.rpc ?.map((x) => x.address) @@ -41,14 +46,10 @@ onMounted(() => {

{{ $t('statesync.title') }}

{{ $t('statesync.description') }} - {{ $t('statesync.here') }}  - - {{ $t('statesync.for_more_info') }}. + {{ + $t('statesync.here') }}  + + {{ $t('statesync.for_more_info') }}.
@@ -67,22 +68,24 @@ onMounted(() => { {{ $t('statesync.text_2_1') }}.

-
[state-sync]
-
enable = true
-
-
rpc_servers = "{{ rpcs }}"
-
trust_height = {{ height }} 
-
trust_hash = "{{hash}}"
-
-
# 2/3 of unbonding time
-
trust_period = "168h"
+
[state-sync]
+
enable = true
+
+
rpc_servers = "{{ rpcs }}"
+
trust_height = {{ height }} 
+
trust_hash = "{{ hash }}"
+
+
# 2/3 of unbonding time
+
trust_period = "168h"

- 3. {{ $t('statesync.text_3') }}: {{ appName }} start + 3. {{ $t('statesync.text_3') }}: {{ appName }} start
{{ $t('statesync.text_3_1') }} {{ appName }} unsafe-reset-all or - {{ appName }} tendermint unsafe-reset-all --home ~/.HOME + {{ appName }} tendermint unsafe-reset-all --home ~/.HOME {{ $t('statesync.text_3_2') }}. @@ -93,13 +96,16 @@ onMounted(() => { {{ $t('statesync.text_title_3') }}

-
[state-sync]
-
# snapshot-interval specifies the block interval at which local state sync snapshots are
-
# taken (0 to disable). Must be a multiple of pruning-keep-every.
-
snapshot-interval = 1000
-
-
# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). Each snapshot is about 500MiB
-
snapshot-keep-recent = 2
+
[state-sync]
+
# snapshot-interval specifies the block interval at which local state sync snapshots are
+
# taken (0 to disable). Must be a multiple of pruning-keep-every.
+
snapshot-interval = 1000
+
+
# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). Each snapshot is about 500MiB
+
snapshot-keep-recent = 2