aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2018-06-27 14:11:21 -0400
committerJohn Newbery <john@johnnewbery.com>2018-06-28 17:56:59 -0400
commitcf15761f6d4526d205126fbf5f088ac8edebeb57 (patch)
tree328cbd7bac30f04deea7d169b357c3b3dd953a32 /src/wallet/wallet.cpp
parent0f3d6e9ab75837ead3acfda342aa3ea404efb81d (diff)
[wallet] GetBalance can take a min_depth argument.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 1038416fe4..25a832e813 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2139,7 +2139,7 @@ void CWallet::ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman
*/
-CAmount CWallet::GetBalance(const isminefilter& filter) const
+CAmount CWallet::GetBalance(const isminefilter& filter, const int min_depth) const
{
CAmount nTotal = 0;
{
@@ -2147,7 +2147,7 @@ CAmount CWallet::GetBalance(const isminefilter& filter) const
for (const auto& entry : mapWallet)
{
const CWalletTx* pcoin = &entry.second;
- if (pcoin->IsTrusted()) {
+ if (pcoin->IsTrusted() && pcoin->GetDepthInMainChain() >= min_depth) {
nTotal += pcoin->GetAvailableCredit(true, filter);
}
}