Skip to content

Commit ef7bc88

Browse files
committed
[wallet] Factor out GetWatchOnlyBalance()
1 parent 4279da4 commit ef7bc88

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

src/interfaces/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class WalletImpl : public Wallet
339339
result.immature_balance = m_wallet.GetImmatureBalance();
340340
result.have_watch_only = m_wallet.HaveWatchOnly();
341341
if (result.have_watch_only) {
342-
result.watch_only_balance = m_wallet.GetWatchOnlyBalance();
342+
result.watch_only_balance = m_wallet.GetBalance(ISMINE_WATCH_ONLY);
343343
result.unconfirmed_watch_only_balance = m_wallet.GetUnconfirmedWatchOnlyBalance();
344344
result.immature_watch_only_balance = m_wallet.GetImmatureWatchOnlyBalance();
345345
}

src/wallet/wallet.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,22 +2211,6 @@ CAmount CWallet::GetImmatureBalance() const
22112211
return nTotal;
22122212
}
22132213

2214-
CAmount CWallet::GetWatchOnlyBalance() const
2215-
{
2216-
CAmount nTotal = 0;
2217-
{
2218-
LOCK2(cs_main, cs_wallet);
2219-
for (const auto& entry : mapWallet)
2220-
{
2221-
const CWalletTx* pcoin = &entry.second;
2222-
if (pcoin->IsTrusted())
2223-
nTotal += pcoin->GetAvailableWatchOnlyCredit();
2224-
}
2225-
}
2226-
2227-
return nTotal;
2228-
}
2229-
22302214
CAmount CWallet::GetUnconfirmedWatchOnlyBalance() const
22312215
{
22322216
CAmount nTotal = 0;

src/wallet/wallet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
947947
CAmount GetBalance(const isminefilter& filter=ISMINE_SPENDABLE) const;
948948
CAmount GetUnconfirmedBalance() const;
949949
CAmount GetImmatureBalance() const;
950-
CAmount GetWatchOnlyBalance() const;
951950
CAmount GetUnconfirmedWatchOnlyBalance() const;
952951
CAmount GetImmatureWatchOnlyBalance() const;
953952
CAmount GetLegacyBalance(const isminefilter& filter, int minDepth, const std::string* account) const;

0 commit comments

Comments
 (0)