diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-03-12 23:16:42 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-03-14 16:05:13 -0400 |
commit | fac1a0fe54287d819cd0967ad6c75bbcb49b332b (patch) | |
tree | cf6e2239e54bf7e38ac264a917aa883b1f529fe5 /src/wallet | |
parent | faa3a246e8809b4954a4a6d202fe8c7f7f776b6e (diff) |
wallet: Remove unused GetLegacyBalance
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet.cpp | 40 | ||||
-rw-r--r-- | src/wallet/wallet.h | 1 |
2 files changed, 0 insertions, 41 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cd1a37e3e9..c0a650f878 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2252,46 +2252,6 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const return nTotal; } -// Calculate total balance in a different way from GetBalance. The biggest -// difference is that GetBalance sums up all unspent TxOuts paying to the -// wallet, while this sums up both spent and unspent TxOuts paying to the -// wallet, and then subtracts the values of TxIns spending from the wallet. This -// also has fewer restrictions on which unconfirmed transactions are considered -// trusted. -CAmount CWallet::GetLegacyBalance(const isminefilter& filter, int minDepth) const -{ - auto locked_chain = chain().lock(); - LOCK(cs_wallet); - - CAmount balance = 0; - for (const auto& entry : mapWallet) { - const CWalletTx& wtx = entry.second; - const int depth = wtx.GetDepthInMainChain(*locked_chain); - if (depth < 0 || !locked_chain->checkFinalTx(*wtx.tx) || wtx.IsImmatureCoinBase(*locked_chain)) { - continue; - } - - // Loop through tx outputs and add incoming payments. For outgoing txs, - // treat change outputs specially, as part of the amount debited. - CAmount debit = wtx.GetDebit(filter); - const bool outgoing = debit > 0; - for (const CTxOut& out : wtx.tx->vout) { - if (outgoing && IsChange(out)) { - debit -= out.nValue; - } else if (IsMine(out) & filter && depth >= minDepth) { - balance += out.nValue; - } - } - - // For outgoing txs, subtract amount debited. - if (outgoing) { - balance -= debit; - } - } - - return balance; -} - CAmount CWallet::GetAvailableBalance(const CCoinControl* coinControl) const { auto locked_chain = chain().lock(); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index ea196c8799..4eedf37da7 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -950,7 +950,6 @@ public: CAmount GetImmatureBalance() const; CAmount GetUnconfirmedWatchOnlyBalance() const; CAmount GetImmatureWatchOnlyBalance() const; - CAmount GetLegacyBalance(const isminefilter& filter, int minDepth) const; CAmount GetAvailableBalance(const CCoinControl* coinControl = nullptr) const; OutputType TransactionChangeType(OutputType change_type, const std::vector<CRecipient>& vecSend); |