From 1f978f561c3e2944e2478c7231cc04318f52677b Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 9 Jul 2015 06:34:30 +0300 Subject: [PATCH] Temporary unlock MN coins locked by -mnconflock on masternode start-alias/many and immediately lock them back right after finding all available coins --- src/activemasternode.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/activemasternode.cpp b/src/activemasternode.cpp index 6c1135fcc..392c67477 100644 --- a/src/activemasternode.cpp +++ b/src/activemasternode.cpp @@ -3,6 +3,7 @@ #include "activemasternode.h" #include "masternodeman.h" #include "masternode.h" +#include "masternodeconfig.h" #include // @@ -302,10 +303,28 @@ vector CActiveMasternode::SelectCoinsMasternode() { vector vCoins; vector filteredCoins; + vector 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(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) {