mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
wallet: IsSpent, 'COutPoint' arg instead of (hash, index)
This commit is contained in:
@@ -204,9 +204,8 @@ CAmount CachedTxGetAvailableCredit(const CWallet& wallet, const CWalletTx& wtx,
|
||||
bool allow_used_addresses = (filter & ISMINE_USED) || !wallet.IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE);
|
||||
CAmount nCredit = 0;
|
||||
uint256 hashTx = wtx.GetHash();
|
||||
for (unsigned int i = 0; i < wtx.tx->vout.size(); i++)
|
||||
{
|
||||
if (!wallet.IsSpent(hashTx, i) && (allow_used_addresses || !wallet.IsSpentKey(hashTx, i))) {
|
||||
for (unsigned int i = 0; i < wtx.tx->vout.size(); i++) {
|
||||
if (!wallet.IsSpent(COutPoint(hashTx, i)) && (allow_used_addresses || !wallet.IsSpentKey(hashTx, i))) {
|
||||
const CTxOut &txout = wtx.tx->vout[i];
|
||||
nCredit += OutputGetCredit(wallet, txout, filter);
|
||||
if (!MoneyRange(nCredit))
|
||||
@@ -371,15 +370,15 @@ std::map<CTxDestination, CAmount> GetAddressBalances(const CWallet& wallet)
|
||||
if (nDepth < (CachedTxIsFromMe(wallet, wtx, ISMINE_ALL) ? 0 : 1))
|
||||
continue;
|
||||
|
||||
for (unsigned int i = 0; i < wtx.tx->vout.size(); i++)
|
||||
{
|
||||
for (unsigned int i = 0; i < wtx.tx->vout.size(); i++) {
|
||||
const auto& output = wtx.tx->vout[i];
|
||||
CTxDestination addr;
|
||||
if (!wallet.IsMine(wtx.tx->vout[i]))
|
||||
if (!wallet.IsMine(output))
|
||||
continue;
|
||||
if(!ExtractDestination(wtx.tx->vout[i].scriptPubKey, addr))
|
||||
if(!ExtractDestination(output.scriptPubKey, addr))
|
||||
continue;
|
||||
|
||||
CAmount n = wallet.IsSpent(walletEntry.first, i) ? 0 : wtx.tx->vout[i].nValue;
|
||||
CAmount n = wallet.IsSpent(COutPoint(walletEntry.first, i)) ? 0 : output.nValue;
|
||||
balances[addr] += n;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user