trivial: access activeMasternodeInfo when lock is in scope

This commit is contained in:
Kittywhiskers Van Gogh 2024-03-12 01:24:39 +00:00
parent 1c30df0afe
commit 9a3c5a3c48
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -1606,8 +1606,11 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc
StartScriptCheckWorkerThreads(script_threads);
}
assert(activeMasternodeInfo.blsKeyOperator == nullptr);
assert(activeMasternodeInfo.blsPubKeyOperator == nullptr);
{
LOCK(activeMasternodeInfoCs);
assert(activeMasternodeInfo.blsKeyOperator == nullptr);
assert(activeMasternodeInfo.blsPubKeyOperator == nullptr);
}
fMasternodeMode = false;
std::string strMasterNodeBLSPrivKey = args.GetArg("-masternodeblsprivkey", "");
if (!strMasterNodeBLSPrivKey.empty()) {
@ -1620,11 +1623,11 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc
LOCK(activeMasternodeInfoCs);
activeMasternodeInfo.blsKeyOperator = std::make_unique<CBLSSecretKey>(keyOperator);
activeMasternodeInfo.blsPubKeyOperator = std::make_unique<CBLSPublicKey>(keyOperator.GetPublicKey());
// We don't know the actual scheme at this point, print both
LogPrintf("MASTERNODE:\n blsPubKeyOperator legacy: %s\n blsPubKeyOperator basic: %s\n",
activeMasternodeInfo.blsPubKeyOperator->ToString(true),
activeMasternodeInfo.blsPubKeyOperator->ToString(false));
}
// We don't know the actual scheme at this point, print both
LogPrintf("MASTERNODE:\n blsPubKeyOperator legacy: %s\n blsPubKeyOperator basic: %s\n",
activeMasternodeInfo.blsPubKeyOperator->ToString(true),
activeMasternodeInfo.blsPubKeyOperator->ToString(false));
} else {
LOCK(activeMasternodeInfoCs);
activeMasternodeInfo.blsKeyOperator = std::make_unique<CBLSSecretKey>();