CMasternodeConfig::read shouldn't spam into debug.log, instead AppInit2 should print current masternode.conf location. Processing masternode.conf to lock inputs should also be performed only when current node is not a masternode. (#1046)
This commit is contained in:
parent
64ba0dc6d0
commit
4316b4e277
34
src/init.cpp
34
src/init.cpp
@ -1800,24 +1800,26 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
} else {
|
||||
return InitError(_("You must specify a masternodeprivkey in the configuration. Please see documentation for help."));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogPrintf("Using masternode config file %s\n", GetMasternodeConfigFile().string());
|
||||
|
||||
if(GetBoolArg("-mnconflock", true) && pwalletMain) {
|
||||
LOCK(pwalletMain->cs_wallet);
|
||||
LogPrintf("Locking Masternodes:\n");
|
||||
uint256 mnTxHash;
|
||||
int outputIndex;
|
||||
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
|
||||
mnTxHash.SetHex(mne.getTxHash());
|
||||
outputIndex = boost::lexical_cast<unsigned int>(mne.getOutputIndex());
|
||||
COutPoint outpoint = COutPoint(mnTxHash, outputIndex);
|
||||
// don't lock non-spendable outpoint (i.e. it's already spent or it's not from this wallet at all)
|
||||
if(pwalletMain->IsMine(CTxIn(outpoint)) != ISMINE_SPENDABLE) {
|
||||
LogPrintf(" %s %s - IS NOT SPENDABLE, was not locked\n", mne.getTxHash(), mne.getOutputIndex());
|
||||
continue;
|
||||
if(GetBoolArg("-mnconflock", true) && pwalletMain) {
|
||||
LOCK(pwalletMain->cs_wallet);
|
||||
LogPrintf("Locking Masternodes:\n");
|
||||
uint256 mnTxHash;
|
||||
int outputIndex;
|
||||
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
|
||||
mnTxHash.SetHex(mne.getTxHash());
|
||||
outputIndex = boost::lexical_cast<unsigned int>(mne.getOutputIndex());
|
||||
COutPoint outpoint = COutPoint(mnTxHash, outputIndex);
|
||||
// don't lock non-spendable outpoint (i.e. it's already spent or it's not from this wallet at all)
|
||||
if(pwalletMain->IsMine(CTxIn(outpoint)) != ISMINE_SPENDABLE) {
|
||||
LogPrintf(" %s %s - IS NOT SPENDABLE, was not locked\n", mne.getTxHash(), mne.getOutputIndex());
|
||||
continue;
|
||||
}
|
||||
pwalletMain->LockCoin(outpoint);
|
||||
LogPrintf(" %s %s - locked successfully\n", mne.getTxHash(), mne.getOutputIndex());
|
||||
}
|
||||
pwalletMain->LockCoin(outpoint);
|
||||
LogPrintf(" %s %s - locked successfully\n", mne.getTxHash(), mne.getOutputIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,6 @@ bool CMasternodeConfig::read(std::string& strErr) {
|
||||
boost::filesystem::path pathMasternodeConfigFile = GetMasternodeConfigFile();
|
||||
boost::filesystem::ifstream streamConfig(pathMasternodeConfigFile);
|
||||
|
||||
LogPrintf("loading masternode file at %s\n", pathMasternodeConfigFile.string());
|
||||
|
||||
if (!streamConfig.good()) {
|
||||
FILE* configFile = fopen(pathMasternodeConfigFile.string().c_str(), "a");
|
||||
if (configFile != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user