aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
diff options
context:
space:
mode:
authorCozz Lovan <cozzlovan@yahoo.com>2014-07-26 21:05:11 +0200
committerCozz Lovan <cozzlovan@yahoo.com>2014-10-03 04:29:51 +0200
commitccca27a788fe1ae13661308243c20a1d7a3d0074 (patch)
treeb862f0f1e0fe98fdd1957cc2236076fef899cc50 /src/wallet.h
parent29f96e8bc652cb14c6fdefe5279ee983054faa2a (diff)
[Wallet] Watch-only fixes
Diffstat (limited to 'src/wallet.h')
-rw-r--r--src/wallet.h34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/wallet.h b/src/wallet.h
index f3fffb2253..1ccc29d3c8 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -222,6 +222,7 @@ public:
// Adds a watch-only address to the store, and saves it to disk.
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)
bool LoadWatchOnly(const CScript &dest);
@@ -701,18 +702,37 @@ public:
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
if (IsCoinBase() && GetBlocksToMaturity() > 0)
return 0;
- // GetBalance can assume transactions in mapWallet won't change
- if (fUseCache && fCreditCached)
- return nCreditCached;
- nCreditCached = pwallet->GetCredit(*this, ISMINE_ALL);
- fCreditCached = true;
- return nCreditCached;
+ int64_t credit = 0;
+ if (filter & ISMINE_SPENDABLE)
+ {
+ // GetBalance can assume transactions in mapWallet won't change
+ if (fCreditCached)
+ 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