Merge #885: Fix mnconflock

fd5cca7 Fix mnconflock - could lock spent input if it still was in masternode.conf which makes no sense and looks confusing
This commit is contained in:
UdjinM6 2016-06-13 10:39:34 +04:00 committed by Holger Schinzel
parent 2252f30a66
commit 5945b7053e

View File

@ -1863,11 +1863,18 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LOCK(pwalletMain->cs_wallet);
LogPrintf("Locking Masternodes:\n");
uint256 mnTxHash;
int outputIndex;
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
LogPrintf(" %s %s\n", mne.getTxHash(), mne.getOutputIndex());
mnTxHash.SetHex(mne.getTxHash());
COutPoint outpoint = COutPoint(mnTxHash, boost::lexical_cast<unsigned int>(mne.getOutputIndex()));
outputIndex = boost::lexical_cast<unsigned int>(mne.getOutputIndex());
// don't lock spent
if(pwalletMain->IsSpent(mnTxHash, outputIndex)) {
LogPrintf(" %s %s - SPENT, not locked\n", mne.getTxHash(), mne.getOutputIndex());
continue;
}
COutPoint outpoint = COutPoint(mnTxHash, outputIndex);
pwalletMain->LockCoin(outpoint);
LogPrintf(" %s %s - locked successfully\n", mne.getTxHash(), mne.getOutputIndex());
}
}