Browse Source

qt: Hide unspendable outputs in coin control

0.10
Wladimir J. van der Laan 11 years ago committed by JaSK
parent
commit
2935b21103
  1. 4
      src/qt/walletmodel.cpp
  2. 2
      src/wallet.cpp

4
src/qt/walletmodel.cpp

@ -60,6 +60,7 @@ qint64 WalletModel::getBalance(const CCoinControl *coinControl) const @@ -60,6 +60,7 @@ qint64 WalletModel::getBalance(const CCoinControl *coinControl) const
std::vector<COutput> vCoins;
wallet->AvailableCoins(vCoins, true, coinControl);
BOOST_FOREACH(const COutput& out, vCoins)
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) @@ -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);
}
}

2
src/wallet.cpp

@ -1259,6 +1259,8 @@ bool CWallet::SelectCoins(int64_t nTargetValue, set<pair<const CWalletTx*,unsign @@ -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));
}

Loading…
Cancel
Save