Merge pull request #138 from UdjinM6/fix_AvailableCoins

always get only confirmed coins by AvailableCoins for every DS relative action
This commit is contained in:
evan82 2015-01-30 07:40:13 -07:00
commit 366435253f
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
vector<COutput> CActiveMasternode::SelectCoinsMasternode()
{
CCoinControl *coinControl=NULL;
vector<COutput> vCoins;
vector<COutput> filteredCoins;
// Retrieve all possible outputs
pwalletMain->AvailableCoins(vCoins, true, coinControl, ALL_COINS);
pwalletMain->AvailableCoins(vCoins);
// Filter
BOOST_FOREACH(const COutput& out, vCoins)

View File

@ -1538,14 +1538,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)
{
CCoinControl *coinControl=NULL;
setCoinsRet.clear();
nValueRet = 0;
setCoinsRet2.clear();
vector<COutput> vCoins;
AvailableCoins(vCoins, false, coinControl, ALL_COINS);
AvailableCoins(vCoins);
//order the array so fees are first, then denominated money, then the rest.
std::random_shuffle(vCoins.rbegin(), vCoins.rend());
@ -1624,7 +1622,7 @@ bool CWallet::SelectCoinsDark(int64_t nValueMin, int64_t nValueMax, std::vector<
nValueRet = 0;
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;
@ -1660,12 +1658,10 @@ bool CWallet::SelectCoinsDark(int64_t nValueMin, int64_t nValueMax, std::vector<
bool CWallet::SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, int64_t& nValueRet) const
{
CCoinControl *coinControl=NULL;
vector<COutput> vCoins;
//printf(" selecting coins for collateral\n");
AvailableCoins(vCoins, false, coinControl, ALL_COINS);
AvailableCoins(vCoins);
//printf("found coins %d\n", (int)vCoins.size());
@ -1720,10 +1716,8 @@ int CWallet::CountInputsWithAmount(int64_t nInputAmount)
bool CWallet::HasCollateralInputs() const
{
CCoinControl *coinControl=NULL;
vector<COutput> vCoins;
AvailableCoins(vCoins, false, coinControl, ALL_COINS);
AvailableCoins(vCoins);
int nFound = 0;
BOOST_FOREACH(const COutput& out, vCoins)