[wallet] GetBalance can take a min_depth argument.
(cherry picked from commit cf15761f6d4526d205126fbf5f088ac8edebeb57)
This commit is contained in:
parent
55f95b12d7
commit
5dd21ca625
|
@ -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;
|
CAmount nTotal = 0;
|
||||||
{
|
{
|
||||||
|
@ -3137,7 +3137,7 @@ CAmount CWallet::GetBalance(const isminefilter& filter) const
|
||||||
for (const auto& entry : mapWallet)
|
for (const auto& entry : mapWallet)
|
||||||
{
|
{
|
||||||
const CWalletTx* pcoin = &entry.second;
|
const CWalletTx* pcoin = &entry.second;
|
||||||
if (pcoin->IsTrusted()) {
|
if (pcoin->IsTrusted() && pcoin->GetDepthInMainChain() >= min_depth) {
|
||||||
nTotal += pcoin->GetAvailableCredit(true, filter);
|
nTotal += pcoin->GetAvailableCredit(true, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ public:
|
||||||
void ReacceptWalletTransactions();
|
void ReacceptWalletTransactions();
|
||||||
void ResendWalletTransactions(int64_t nBestBlockTime);
|
void ResendWalletTransactions(int64_t nBestBlockTime);
|
||||||
std::vector<uint256> ResendWalletTransactionsBefore(int64_t nTime);
|
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 GetUnconfirmedBalance() const;
|
||||||
CAmount GetImmatureBalance() const;
|
CAmount GetImmatureBalance() const;
|
||||||
CAmount GetUnconfirmedWatchOnlyBalance() const;
|
CAmount GetUnconfirmedWatchOnlyBalance() const;
|
||||||
|
|
Loading…
Reference in New Issue