Skip to content

Commit

Permalink
Merge pull request #418 from UdjinM6/v0.12.0.x_temporary_unlock_mn_coins
Browse files Browse the repository at this point in the history
V0.12.0.x Temporary unlock MN coins (locked by -mnconflock) on masternode start-alias/many
  • Loading branch information
evan82 committed Jul 10, 2015
2 parents 4a514b7 + 1f978f5 commit b360b87
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "activemasternode.h"
#include "masternodeman.h"
#include "masternode.h"
#include "masternodeconfig.h"
#include <boost/lexical_cast.hpp>

//
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit b360b87

Please sign in to comment.