Temporary unlock MN coins locked by -mnconflock on masternode start-alias/many and immediately lock them back right after finding all available coins

This commit is contained in:
UdjinM6 2015-07-09 06:34:30 +03:00
parent 4a514b7e7c
commit 1f978f561c

View File

@ -3,6 +3,7 @@
#include "activemasternode.h"
#include "masternodeman.h"
#include "masternode.h"
#include "masternodeconfig.h"
#include <boost/lexical_cast.hpp>
//
@ -302,10 +303,28 @@ vector<COutput> CActiveMasternode::SelectCoinsMasternode()
{
vector<COutput> vCoins;
vector<COutput> filteredCoins;
vector<COutPoint> confLockedCoins;
// Temporary unlock MN coins from masternode.conf
if(GetBoolArg("-mnconflock", true)) {
uint256 mnTxHash;
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
mnTxHash.SetHex(mne.getTxHash());
COutPoint outpoint = COutPoint(mnTxHash, boost::lexical_cast<unsigned int>(mne.getOutputIndex()));
confLockedCoins.push_back(outpoint);
pwalletMain->UnlockCoin(outpoint);
}
}
// Retrieve all possible outputs
pwalletMain->AvailableCoins(vCoins);
// Lock MN coins from masternode.conf back if they where temporary unlocked
if(!confLockedCoins.empty()) {
BOOST_FOREACH(COutPoint outpoint, confLockedCoins)
pwalletMain->LockCoin(outpoint);
}
// Filter
BOOST_FOREACH(const COutput& out, vCoins)
{