Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,633 Lines • ▼ Show 20 Lines | static UniValue listunspent(const Config &config, | ||||
const bool avoid_reuse = pwallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE); | const bool avoid_reuse = pwallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE); | ||||
for (const COutput &out : vecOutputs) { | for (const COutput &out : vecOutputs) { | ||||
CTxDestination address; | CTxDestination address; | ||||
const CScript &scriptPubKey = out.tx->tx->vout[out.i].scriptPubKey; | const CScript &scriptPubKey = out.tx->tx->vout[out.i].scriptPubKey; | ||||
bool fValidAddress = ExtractDestination(scriptPubKey, address); | bool fValidAddress = ExtractDestination(scriptPubKey, address); | ||||
bool reused = | bool reused = | ||||
avoid_reuse && pwallet->IsUsedDestination(out.tx->GetId(), out.i); | avoid_reuse && pwallet->IsSpentKey(out.tx->GetId(), out.i); | ||||
if (destinations.size() && | if (destinations.size() && | ||||
(!fValidAddress || !destinations.count(address))) { | (!fValidAddress || !destinations.count(address))) { | ||||
continue; | continue; | ||||
} | } | ||||
UniValue entry(UniValue::VOBJ); | UniValue entry(UniValue::VOBJ); | ||||
entry.pushKV("txid", out.tx->GetId().GetHex()); | entry.pushKV("txid", out.tx->GetId().GetHex()); | ||||
▲ Show 20 Lines • Show All 1,436 Lines • Show Last 20 Lines |