|
|
@ -288,12 +288,12 @@ public: |
|
|
|
std::set<CTxDestination> GetAccountAddresses(std::string strAccount) const; |
|
|
|
std::set<CTxDestination> GetAccountAddresses(std::string strAccount) const; |
|
|
|
|
|
|
|
|
|
|
|
isminetype IsMine(const CTxIn& txin) const; |
|
|
|
isminetype IsMine(const CTxIn& txin) const; |
|
|
|
int64_t GetDebit(const CTxIn& txin) const; |
|
|
|
int64_t GetDebit(const CTxIn& txin, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const; |
|
|
|
isminetype IsMine(const CTxOut& txout) const |
|
|
|
isminetype IsMine(const CTxOut& txout) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ::IsMine(*this, txout.scriptPubKey); |
|
|
|
return ::IsMine(*this, txout.scriptPubKey); |
|
|
|
} |
|
|
|
} |
|
|
|
int64_t GetCredit(const CTxOut& txout, const isminefilter& filter = (MINE_WATCH_ONLY | MINE_SPENDABLE)) const |
|
|
|
int64_t GetCredit(const CTxOut& txout, const isminefilter& filter=(MINE_WATCH_ONLY|MINE_SPENDABLE)) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!MoneyRange(txout.nValue)) |
|
|
|
if (!MoneyRange(txout.nValue)) |
|
|
|
throw std::runtime_error("CWallet::GetCredit() : value out of range"); |
|
|
|
throw std::runtime_error("CWallet::GetCredit() : value out of range"); |
|
|
@ -324,12 +324,12 @@ public: |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
int64_t GetDebit(const CTransaction& tx) const |
|
|
|
int64_t GetDebit(const CTransaction& tx, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
int64_t nDebit = 0; |
|
|
|
int64_t nDebit = 0; |
|
|
|
BOOST_FOREACH(const CTxIn& txin, tx.vin) |
|
|
|
BOOST_FOREACH(const CTxIn& txin, tx.vin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
nDebit += GetDebit(txin); |
|
|
|
nDebit += GetDebit(txin, filter); |
|
|
|
if (!MoneyRange(nDebit)) |
|
|
|
if (!MoneyRange(nDebit)) |
|
|
|
throw std::runtime_error("CWallet::GetDebit() : value out of range"); |
|
|
|
throw std::runtime_error("CWallet::GetDebit() : value out of range"); |
|
|
|
} |
|
|
|
} |
|
|
@ -486,6 +486,8 @@ public: |
|
|
|
mutable bool fCreditCached; |
|
|
|
mutable bool fCreditCached; |
|
|
|
mutable bool fImmatureCreditCached; |
|
|
|
mutable bool fImmatureCreditCached; |
|
|
|
mutable bool fAvailableCreditCached; |
|
|
|
mutable bool fAvailableCreditCached; |
|
|
|
|
|
|
|
mutable bool fWatchDebitCached; |
|
|
|
|
|
|
|
mutable bool fWatchCreditCached; |
|
|
|
mutable bool fImmatureWatchCreditCached; |
|
|
|
mutable bool fImmatureWatchCreditCached; |
|
|
|
mutable bool fAvailableWatchCreditCached; |
|
|
|
mutable bool fAvailableWatchCreditCached; |
|
|
|
mutable bool fChangeCached; |
|
|
|
mutable bool fChangeCached; |
|
|
@ -493,6 +495,8 @@ public: |
|
|
|
mutable int64_t nCreditCached; |
|
|
|
mutable int64_t nCreditCached; |
|
|
|
mutable int64_t nImmatureCreditCached; |
|
|
|
mutable int64_t nImmatureCreditCached; |
|
|
|
mutable int64_t nAvailableCreditCached; |
|
|
|
mutable int64_t nAvailableCreditCached; |
|
|
|
|
|
|
|
mutable int64_t nWatchDebitCached; |
|
|
|
|
|
|
|
mutable int64_t nWatchCreditCached; |
|
|
|
mutable int64_t nImmatureWatchCreditCached; |
|
|
|
mutable int64_t nImmatureWatchCreditCached; |
|
|
|
mutable int64_t nAvailableWatchCreditCached; |
|
|
|
mutable int64_t nAvailableWatchCreditCached; |
|
|
|
mutable int64_t nChangeCached; |
|
|
|
mutable int64_t nChangeCached; |
|
|
@ -531,6 +535,8 @@ public: |
|
|
|
fCreditCached = false; |
|
|
|
fCreditCached = false; |
|
|
|
fImmatureCreditCached = false; |
|
|
|
fImmatureCreditCached = false; |
|
|
|
fAvailableCreditCached = false; |
|
|
|
fAvailableCreditCached = false; |
|
|
|
|
|
|
|
fWatchDebitCached = false; |
|
|
|
|
|
|
|
fWatchCreditCached = false; |
|
|
|
fImmatureWatchCreditCached = false; |
|
|
|
fImmatureWatchCreditCached = false; |
|
|
|
fAvailableWatchCreditCached = false; |
|
|
|
fAvailableWatchCreditCached = false; |
|
|
|
fChangeCached = false; |
|
|
|
fChangeCached = false; |
|
|
@ -538,6 +544,8 @@ public: |
|
|
|
nCreditCached = 0; |
|
|
|
nCreditCached = 0; |
|
|
|
nImmatureCreditCached = 0; |
|
|
|
nImmatureCreditCached = 0; |
|
|
|
nAvailableCreditCached = 0; |
|
|
|
nAvailableCreditCached = 0; |
|
|
|
|
|
|
|
nWatchDebitCached = 0; |
|
|
|
|
|
|
|
nWatchCreditCached = 0; |
|
|
|
nAvailableWatchCreditCached = 0; |
|
|
|
nAvailableWatchCreditCached = 0; |
|
|
|
nImmatureWatchCreditCached = 0; |
|
|
|
nImmatureWatchCreditCached = 0; |
|
|
|
nChangeCached = 0; |
|
|
|
nChangeCached = 0; |
|
|
@ -592,6 +600,8 @@ public: |
|
|
|
{ |
|
|
|
{ |
|
|
|
fCreditCached = false; |
|
|
|
fCreditCached = false; |
|
|
|
fAvailableCreditCached = false; |
|
|
|
fAvailableCreditCached = false; |
|
|
|
|
|
|
|
fWatchDebitCached = false; |
|
|
|
|
|
|
|
fWatchCreditCached = false; |
|
|
|
fAvailableWatchCreditCached = false; |
|
|
|
fAvailableWatchCreditCached = false; |
|
|
|
fImmatureWatchCreditCached = false; |
|
|
|
fImmatureWatchCreditCached = false; |
|
|
|
fDebitCached = false; |
|
|
|
fDebitCached = false; |
|
|
@ -604,15 +614,35 @@ public: |
|
|
|
MarkDirty(); |
|
|
|
MarkDirty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int64_t GetDebit() const |
|
|
|
int64_t GetDebit(const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (vin.empty()) |
|
|
|
if (vin.empty()) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int64_t debit = 0; |
|
|
|
|
|
|
|
if(filter & MINE_SPENDABLE) |
|
|
|
|
|
|
|
{ |
|
|
|
if (fDebitCached) |
|
|
|
if (fDebitCached) |
|
|
|
return nDebitCached; |
|
|
|
debit += nDebitCached; |
|
|
|
nDebitCached = pwallet->GetDebit(*this); |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
nDebitCached = pwallet->GetDebit(*this, MINE_SPENDABLE); |
|
|
|
fDebitCached = true; |
|
|
|
fDebitCached = true; |
|
|
|
return nDebitCached; |
|
|
|
debit += nDebitCached; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(filter & MINE_WATCH_ONLY) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(fWatchDebitCached) |
|
|
|
|
|
|
|
debit += nWatchDebitCached; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
nWatchDebitCached = pwallet->GetDebit(*this, MINE_WATCH_ONLY); |
|
|
|
|
|
|
|
fWatchDebitCached = true; |
|
|
|
|
|
|
|
debit += nWatchDebitCached; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return debit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int64_t GetCredit(bool fUseCache=true) const |
|
|
|
int64_t GetCredit(bool fUseCache=true) const |
|
|
@ -729,7 +759,7 @@ public: |
|
|
|
std::list<std::pair<CTxDestination, int64_t> >& listSent, int64_t& nFee, std::string& strSentAccount, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const; |
|
|
|
std::list<std::pair<CTxDestination, int64_t> >& listSent, int64_t& nFee, std::string& strSentAccount, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const; |
|
|
|
|
|
|
|
|
|
|
|
void GetAccountAmounts(const std::string& strAccount, int64_t& nReceived, |
|
|
|
void GetAccountAmounts(const std::string& strAccount, int64_t& nReceived, |
|
|
|
int64_t& nSent, int64_t& nFee) const; |
|
|
|
int64_t& nSent, int64_t& nFee, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const; |
|
|
|
|
|
|
|
|
|
|
|
bool IsFromMe() const |
|
|
|
bool IsFromMe() const |
|
|
|
{ |
|
|
|
{ |
|
|
|