qt: Hide unspendable outputs in coin control

This commit is contained in:
Wladimir J. van der Laan 2013-12-10 15:27:53 +01:00 committed by JaSK
parent c8988460a2
commit 2935b21103
2 changed files with 6 additions and 2 deletions

View file

@ -60,7 +60,8 @@ qint64 WalletModel::getBalance(const CCoinControl *coinControl) const
std::vector<COutput> vCoins;
wallet->AvailableCoins(vCoins, true, coinControl);
BOOST_FOREACH(const COutput& out, vCoins)
nBalance += out.tx->vout[out.i].nValue;
if(out.fSpendable)
nBalance += out.tx->vout[out.i].nValue;
return nBalance;
}
@ -585,7 +586,8 @@ void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins)
}
CTxDestination address;
if(!ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address)) continue;
if(!out.fSpendable || !ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address))
continue;
mapCoins[CBitcoinAddress(address).ToString().c_str()].push_back(out);
}
}

View file

@ -1259,6 +1259,8 @@ bool CWallet::SelectCoins(int64_t nTargetValue, set<pair<const CWalletTx*,unsign
{
BOOST_FOREACH(const COutput& out, vCoins)
{
if(!out.fSpendable)
continue;
nValueRet += out.tx->vout[out.i].nValue;
setCoinsRet.insert(make_pair(out.tx, out.i));
}