From cf15761f6d4526d205126fbf5f088ac8edebeb57 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Wed, 27 Jun 2018 14:11:21 -0400 Subject: [wallet] GetBalance can take a min_depth argument. --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wallet/wallet.cpp') 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); } } -- cgit v1.2.3