Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guarding wallet access from init and print error for unknown MN collaterals #2218

Merged
merged 2 commits into from
Feb 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,19 +1855,22 @@ bool AppInitMain()
//get the mode of budget voting for this masternode
strBudgetMode = gArgs.GetArg("-budgetvotemode", "auto");

#ifdef ENABLE_WALLET
if (gArgs.GetBoolArg("-mnconflock", DEFAULT_MNCONFLOCK) && pwalletMain) {
LOCK(pwalletMain->cs_wallet);
LogPrintf("Locking Masternodes:\n");
LogPrintf("Locking Masternodes collateral utxo:\n");
uint256 mnTxHash;
for (const CMasternodeConfig::CMasternodeEntry& mne : masternodeConfig.getEntries()) {
LogPrintf(" %s %s\n", mne.getTxHash(), mne.getOutputIndex());
for (const auto& mne : masternodeConfig.getEntries()) {
mnTxHash.SetHex(mne.getTxHash());
COutPoint outpoint = COutPoint(mnTxHash, (unsigned int) std::stoul(mne.getOutputIndex()));
pwalletMain->LockCoin(outpoint);
LogPrintf("Locked collateral, MN: %s, tx hash: %s, output index: %s\n",
mne.getAlias(), mne.getTxHash(), mne.getOutputIndex());
}
}
#endif

//lite mode disables all Masternode related functionality
// lite mode disables all Masternode related functionality
fLiteMode = gArgs.GetBoolArg("-litemode", false);
if (fMasterNode && fLiteMode) {
return UIError("You can not start a masternode in litemode");
Expand Down