Skip to content

Commit

Permalink
trivial: access activeMasternodeInfo when lock is in scope
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Mar 22, 2024
1 parent 1c30df0 commit 9a3c5a3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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>();
Expand Down

0 comments on commit 9a3c5a3

Please sign in to comment.