From 0ce622525ce54c3684711f8d573f76250240cabf Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Tue, 30 Jul 2024 22:41:24 +0700 Subject: [PATCH] fix: we want reindex only if we setup masternode --- .../regular/importCoreDataTaskFactory.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/dashmate/src/listr/tasks/setup/regular/importCoreDataTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/importCoreDataTaskFactory.js index 70ba6b7261e..be338af6633 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/importCoreDataTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/importCoreDataTaskFactory.js @@ -113,15 +113,19 @@ export default function importCoreDataTaskFactory( // Read configuration from dashd.conf const configPath = path.join(coreDataPath, 'dash.conf'); const configFileContent = fs.readFileSync(configPath, 'utf8'); - const masternodeOperatorPrivateKey = configFileContent.match(/^masternodeblsprivkey=([^ \n]+)/m)?.[1]; - if (masternodeOperatorPrivateKey) { - ctx.config.set('core.masternode.operator.privateKey', masternodeOperatorPrivateKey); - // txindex is enabled by default for masternodes - ctx.isReindexRequired = false; - } else { - // We need to reindex Core if there weren't all required indexed enabled before - ctx.isReindexRequired = !configFileContent.match(/^txindex=1/); + // Config file should contain masternodeblsprivkey in case of masternode + if (ctx.config.get('core.masternode.enable')) { + const masternodeOperatorPrivateKey = configFileContent.match(/^masternodeblsprivkey=([^ \n]+)/m)?.[1]; + + if (masternodeOperatorPrivateKey) { + ctx.config.set('core.masternode.operator.privateKey', masternodeOperatorPrivateKey); + // txindex is enabled by default for masternodes + ctx.isReindexRequired = false; + } else { + // We need to reindex Core if there weren't all required indexed enabled before + ctx.isReindexRequired = !configFileContent.match(/^txindex=1/); + } } const host = configFileContent.match(/^bind=([^ \n]+)/m)?.[1];