[wallet] GetBalance can take a min_depth argument.

(cherry picked from commit cf15761f6d4526d205126fbf5f088ac8edebeb57)
This commit is contained in:
John Newbery 2018-06-27 14:11:21 -04:00 committed by Kris Nuttycombe
parent 55f95b12d7
commit 5dd21ca625
2 changed files with 3 additions and 3 deletions

View File

@ -3129,7 +3129,7 @@ void CWallet::ResendWalletTransactions(int64_t nBestBlockTime)
*/
CAmount CWallet::GetBalance(const isminefilter& filter) const
CAmount CWallet::GetBalance(const isminefilter& filter, const int min_depth) const
{
CAmount nTotal = 0;
{
@ -3137,7 +3137,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);
}
}

View File

@ -1177,7 +1177,7 @@ public:
void ReacceptWalletTransactions();
void ResendWalletTransactions(int64_t nBestBlockTime);
std::vector<uint256> ResendWalletTransactionsBefore(int64_t nTime);
CAmount GetBalance(const isminefilter& filter=ISMINE_SPENDABLE) const;
CAmount GetBalance(const isminefilter& filter=ISMINE_SPENDABLE, const int min_depth=0) const;
CAmount GetUnconfirmedBalance() const;
CAmount GetImmatureBalance() const;
CAmount GetUnconfirmedWatchOnlyBalance() const;