Skip to content

Commit

Permalink
fix: we want reindex only if we setup masternode
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Jul 30, 2024
1 parent 7ae5aff commit 0ce6225
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 0ce6225

Please sign in to comment.