always get only confirmed coins by AvailableCoins

This commit is contained in:
UdjinM6 2015-01-30 01:15:04 +03:00
parent 7fafe5d3e1
commit 52dabd1166
2 changed files with 5 additions and 12 deletions

View File

@ -361,12 +361,11 @@ bool CActiveMasternode::GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubke
// get all possible outputs for running masternode // get all possible outputs for running masternode
vector<COutput> CActiveMasternode::SelectCoinsMasternode() vector<COutput> CActiveMasternode::SelectCoinsMasternode()
{ {
CCoinControl *coinControl=NULL;
vector<COutput> vCoins; vector<COutput> vCoins;
vector<COutput> filteredCoins; vector<COutput> filteredCoins;
// Retrieve all possible outputs // Retrieve all possible outputs
pwalletMain->AvailableCoins(vCoins, true, coinControl, ALL_COINS); pwalletMain->AvailableCoins(vCoins);
// Filter // Filter
BOOST_FOREACH(const COutput& out, vCoins) BOOST_FOREACH(const COutput& out, vCoins)

View File

@ -1505,14 +1505,12 @@ struct CompareByPriority
bool CWallet::SelectCoinsByDenominations(int nDenom, int64_t nValueMin, int64_t nValueMax, std::vector<CTxIn>& setCoinsRet, vector<COutput>& setCoinsRet2, int64_t& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax) bool CWallet::SelectCoinsByDenominations(int nDenom, int64_t nValueMin, int64_t nValueMax, std::vector<CTxIn>& setCoinsRet, vector<COutput>& setCoinsRet2, int64_t& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax)
{ {
CCoinControl *coinControl=NULL;
setCoinsRet.clear(); setCoinsRet.clear();
nValueRet = 0; nValueRet = 0;
setCoinsRet2.clear(); setCoinsRet2.clear();
vector<COutput> vCoins; vector<COutput> vCoins;
AvailableCoins(vCoins, false, coinControl, ALL_COINS); AvailableCoins(vCoins);
//order the array so fees are first, then denominated money, then the rest. //order the array so fees are first, then denominated money, then the rest.
std::random_shuffle(vCoins.rbegin(), vCoins.rend()); std::random_shuffle(vCoins.rbegin(), vCoins.rend());
@ -1591,7 +1589,7 @@ bool CWallet::SelectCoinsDark(int64_t nValueMin, int64_t nValueMax, std::vector<
nValueRet = 0; nValueRet = 0;
vector<COutput> vCoins; vector<COutput> vCoins;
AvailableCoins(vCoins, false, coinControl, nDarksendRoundsMin < 0 ? ONLY_NONDENOMINATED_NOTMN : ONLY_DENOMINATED); AvailableCoins(vCoins, true, coinControl, nDarksendRoundsMin < 0 ? ONLY_NONDENOMINATED_NOTMN : ONLY_DENOMINATED);
set<pair<const CWalletTx*,unsigned int> > setCoinsRet2; set<pair<const CWalletTx*,unsigned int> > setCoinsRet2;
@ -1627,12 +1625,10 @@ bool CWallet::SelectCoinsDark(int64_t nValueMin, int64_t nValueMax, std::vector<
bool CWallet::SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, int64_t& nValueRet) const bool CWallet::SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, int64_t& nValueRet) const
{ {
CCoinControl *coinControl=NULL;
vector<COutput> vCoins; vector<COutput> vCoins;
//printf(" selecting coins for collateral\n"); //printf(" selecting coins for collateral\n");
AvailableCoins(vCoins, false, coinControl, ALL_COINS); AvailableCoins(vCoins);
//printf("found coins %d\n", (int)vCoins.size()); //printf("found coins %d\n", (int)vCoins.size());
@ -1687,10 +1683,8 @@ int CWallet::CountInputsWithAmount(int64_t nInputAmount)
bool CWallet::HasCollateralInputs() const bool CWallet::HasCollateralInputs() const
{ {
CCoinControl *coinControl=NULL;
vector<COutput> vCoins; vector<COutput> vCoins;
AvailableCoins(vCoins, false, coinControl, ALL_COINS); AvailableCoins(vCoins);
int nFound = 0; int nFound = 0;
BOOST_FOREACH(const COutput& out, vCoins) BOOST_FOREACH(const COutput& out, vCoins)