Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,514 Lines • ▼ Show 20 Lines | for (const auto &entry : mapWallet) { | ||||
if (nMaximumCount > 0 && vCoins.size() >= nMaximumCount) { | if (nMaximumCount > 0 && vCoins.size() >= nMaximumCount) { | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
std::map<CTxDestination, std::vector<COutput>> CWallet::ListCoins() const { | std::map<CTxDestination, std::vector<COutput>> CWallet::ListCoins() const { | ||||
// TODO: Add AssertLockHeld(cs_wallet) here. | AssertLockHeld(cs_main); | ||||
// | AssertLockHeld(cs_wallet); | ||||
// Because the return value from this function contains pointers to | |||||
// CWalletTx objects, callers to this function really should acquire the | |||||
// cs_wallet lock before calling it. However, the current caller doesn't | |||||
// acquire this lock yet. There was an attempt to add the missing lock in | |||||
// https://github.com/bitcoin/bitcoin/pull/10340, but that change has been | |||||
// postponed until after https://github.com/bitcoin/bitcoin/pull/10244 to | |||||
// avoid adding some extra complexity to the Qt code. | |||||
std::map<CTxDestination, std::vector<COutput>> result; | std::map<CTxDestination, std::vector<COutput>> result; | ||||
std::vector<COutput> availableCoins; | std::vector<COutput> availableCoins; | ||||
LOCK2(cs_main, cs_wallet); | |||||
AvailableCoins(availableCoins); | AvailableCoins(availableCoins); | ||||
for (auto &coin : availableCoins) { | for (auto &coin : availableCoins) { | ||||
CTxDestination address; | CTxDestination address; | ||||
if (coin.fSpendable && | if (coin.fSpendable && | ||||
ExtractDestination( | ExtractDestination( | ||||
FindNonChangeParentOutput(*coin.tx->tx, coin.i).scriptPubKey, | FindNonChangeParentOutput(*coin.tx->tx, coin.i).scriptPubKey, | ||||
address)) { | address)) { | ||||
▲ Show 20 Lines • Show All 2,235 Lines • Show Last 20 Lines |