From 332de8bc3d5d9dceda7e1913f1c0e38733e423c5 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Fri, 8 Jul 2022 16:26:37 +0800 Subject: [PATCH] fix: Fix add block hash into ckb-indexer path. Restart ckb-indexer after restart ckb-node (#2444) --- packages/neuron-wallet/src/controllers/api.ts | 5 +++-- packages/neuron-wallet/src/services/indexer.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/neuron-wallet/src/controllers/api.ts b/packages/neuron-wallet/src/controllers/api.ts index 4a02555d1a..86ed499dda 100644 --- a/packages/neuron-wallet/src/controllers/api.ts +++ b/packages/neuron-wallet/src/controllers/api.ts @@ -464,7 +464,8 @@ export default class ApiController { handle('set-ckb-node-data-path', (_, dataPath: string) => { SettingsService.getInstance().ckbDataPath = dataPath - startMonitor('ckb', true) + stopMonitor('ckb-indexer') + startMonitor(undefined, true) return { status: ResponseCode.Success, result: SettingsService.getInstance().ckbDataPath @@ -483,7 +484,7 @@ export default class ApiController { startMonitor('ckb-indexer', true) return { status: ResponseCode.Success, - result: SettingsService.getInstance().ckbDataPath + result: SettingsService.getInstance().indexerDataPath } }) diff --git a/packages/neuron-wallet/src/services/indexer.ts b/packages/neuron-wallet/src/services/indexer.ts index 954cf741df..f2da7931a8 100644 --- a/packages/neuron-wallet/src/services/indexer.ts +++ b/packages/neuron-wallet/src/services/indexer.ts @@ -191,9 +191,9 @@ export default class IndexerService { #getDataPath = (network: Network): string => { let indexerDataPath = SettingsService.getInstance().indexerDataPath if (!indexerDataPath) { - indexerDataPath = path.resolve(env.fileBasePath, IndexerService.indexerDataFolder, 'data', `${network.genesisHash}`) + indexerDataPath = path.resolve(env.fileBasePath, IndexerService.indexerDataFolder, 'data') SettingsService.getInstance().indexerDataPath = indexerDataPath } - return indexerDataPath + return path.resolve(indexerDataPath, `${network.genesisHash}`) } }