|
|
@ -222,6 +222,7 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
// Adds a watch-only address to the store, and saves it to disk.
|
|
|
|
// Adds a watch-only address to the store, and saves it to disk.
|
|
|
|
bool AddWatchOnly(const CScript &dest); |
|
|
|
bool AddWatchOnly(const CScript &dest); |
|
|
|
|
|
|
|
bool RemoveWatchOnly(const CScript &dest); |
|
|
|
// Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
|
|
|
|
// Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
|
|
|
|
bool LoadWatchOnly(const CScript &dest); |
|
|
|
bool LoadWatchOnly(const CScript &dest); |
|
|
|
|
|
|
|
|
|
|
@ -701,18 +702,37 @@ public: |
|
|
|
return debit; |
|
|
|
return debit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CAmount GetCredit(bool fUseCache=true) const |
|
|
|
CAmount GetCredit(const isminefilter& filter) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Must wait until coinbase is safely deep enough in the chain before valuing it
|
|
|
|
// Must wait until coinbase is safely deep enough in the chain before valuing it
|
|
|
|
if (IsCoinBase() && GetBlocksToMaturity() > 0) |
|
|
|
if (IsCoinBase() && GetBlocksToMaturity() > 0) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
// GetBalance can assume transactions in mapWallet won't change
|
|
|
|
int64_t credit = 0; |
|
|
|
if (fUseCache && fCreditCached) |
|
|
|
if (filter & ISMINE_SPENDABLE) |
|
|
|
return nCreditCached; |
|
|
|
{ |
|
|
|
nCreditCached = pwallet->GetCredit(*this, ISMINE_ALL); |
|
|
|
// GetBalance can assume transactions in mapWallet won't change
|
|
|
|
fCreditCached = true; |
|
|
|
if (fCreditCached) |
|
|
|
return nCreditCached; |
|
|
|
credit += nCreditCached; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
nCreditCached = pwallet->GetCredit(*this, ISMINE_SPENDABLE); |
|
|
|
|
|
|
|
fCreditCached = true; |
|
|
|
|
|
|
|
credit += nCreditCached; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (filter & ISMINE_WATCH_ONLY) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (fWatchCreditCached) |
|
|
|
|
|
|
|
credit += nWatchCreditCached; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
nWatchCreditCached = pwallet->GetCredit(*this, ISMINE_WATCH_ONLY); |
|
|
|
|
|
|
|
fWatchCreditCached = true; |
|
|
|
|
|
|
|
credit += nWatchCreditCached; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return credit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CAmount GetImmatureCredit(bool fUseCache=true) const |
|
|
|
CAmount GetImmatureCredit(bool fUseCache=true) const |
|
|
|