Skip to content

Commit fac1a0f

Browse files
author
MarcoFalke
committed
wallet: Remove unused GetLegacyBalance
1 parent faa3a24 commit fac1a0f

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

src/wallet/wallet.cpp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,46 +2252,6 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
22522252
return nTotal;
22532253
}
22542254

2255-
// Calculate total balance in a different way from GetBalance. The biggest
2256-
// difference is that GetBalance sums up all unspent TxOuts paying to the
2257-
// wallet, while this sums up both spent and unspent TxOuts paying to the
2258-
// wallet, and then subtracts the values of TxIns spending from the wallet. This
2259-
// also has fewer restrictions on which unconfirmed transactions are considered
2260-
// trusted.
2261-
CAmount CWallet::GetLegacyBalance(const isminefilter& filter, int minDepth) const
2262-
{
2263-
auto locked_chain = chain().lock();
2264-
LOCK(cs_wallet);
2265-
2266-
CAmount balance = 0;
2267-
for (const auto& entry : mapWallet) {
2268-
const CWalletTx& wtx = entry.second;
2269-
const int depth = wtx.GetDepthInMainChain(*locked_chain);
2270-
if (depth < 0 || !locked_chain->checkFinalTx(*wtx.tx) || wtx.IsImmatureCoinBase(*locked_chain)) {
2271-
continue;
2272-
}
2273-
2274-
// Loop through tx outputs and add incoming payments. For outgoing txs,
2275-
// treat change outputs specially, as part of the amount debited.
2276-
CAmount debit = wtx.GetDebit(filter);
2277-
const bool outgoing = debit > 0;
2278-
for (const CTxOut& out : wtx.tx->vout) {
2279-
if (outgoing && IsChange(out)) {
2280-
debit -= out.nValue;
2281-
} else if (IsMine(out) & filter && depth >= minDepth) {
2282-
balance += out.nValue;
2283-
}
2284-
}
2285-
2286-
// For outgoing txs, subtract amount debited.
2287-
if (outgoing) {
2288-
balance -= debit;
2289-
}
2290-
}
2291-
2292-
return balance;
2293-
}
2294-
22952255
CAmount CWallet::GetAvailableBalance(const CCoinControl* coinControl) const
22962256
{
22972257
auto locked_chain = chain().lock();

src/wallet/wallet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,6 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
950950
CAmount GetImmatureBalance() const;
951951
CAmount GetUnconfirmedWatchOnlyBalance() const;
952952
CAmount GetImmatureWatchOnlyBalance() const;
953-
CAmount GetLegacyBalance(const isminefilter& filter, int minDepth) const;
954953
CAmount GetAvailableBalance(const CCoinControl* coinControl = nullptr) const;
955954

956955
OutputType TransactionChangeType(OutputType change_type, const std::vector<CRecipient>& vecSend);

0 commit comments

Comments
 (0)