|
|
|
@ -288,12 +288,12 @@ public:
|
|
|
|
|
std::set<CTxDestination> GetAccountAddresses(std::string strAccount) const;
|
|
|
|
|
|
|
|
|
|
isminetype IsMine(const CTxIn& txin) const;
|
|
|
|
|
int64_t GetDebit(const CTxIn& txin, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const;
|
|
|
|
|
int64_t GetDebit(const CTxIn& txin, const isminefilter& filter) const;
|
|
|
|
|
isminetype IsMine(const CTxOut& txout) const
|
|
|
|
|
{
|
|
|
|
|
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) const
|
|
|
|
|
{
|
|
|
|
|
if (!MoneyRange(txout.nValue))
|
|
|
|
|
throw std::runtime_error("CWallet::GetCredit() : value out of range");
|
|
|
|
@ -313,9 +313,9 @@ public:
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool IsFromMe(const CTransaction& tx) const
|
|
|
|
|
bool IsFromMe(const CTransaction& tx) const // should probably be renamed to IsRelevantToMe
|
|
|
|
|
{
|
|
|
|
|
return (GetDebit(tx) > 0);
|
|
|
|
|
return (GetDebit(tx, MINE_SPENDABLE|MINE_WATCH_ONLY) > 0);
|
|
|
|
|
}
|
|
|
|
|
bool IsConflicting(const CTransaction& tx) const
|
|
|
|
|
{
|
|
|
|
@ -324,7 +324,7 @@ public:
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
int64_t GetDebit(const CTransaction& tx, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const
|
|
|
|
|
int64_t GetDebit(const CTransaction& tx, const isminefilter& filter) const
|
|
|
|
|
{
|
|
|
|
|
int64_t nDebit = 0;
|
|
|
|
|
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
|
|
|
@ -335,7 +335,7 @@ public:
|
|
|
|
|
}
|
|
|
|
|
return nDebit;
|
|
|
|
|
}
|
|
|
|
|
int64_t GetCredit(const CTransaction& tx, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const
|
|
|
|
|
int64_t GetCredit(const CTransaction& tx, const isminefilter& filter) const
|
|
|
|
|
{
|
|
|
|
|
int64_t nCredit = 0;
|
|
|
|
|
BOOST_FOREACH(const CTxOut& txout, tx.vout)
|
|
|
|
@ -614,7 +614,8 @@ public:
|
|
|
|
|
MarkDirty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int64_t GetDebit(const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const
|
|
|
|
|
// filter decides which addresses will count towards the debit
|
|
|
|
|
int64_t GetDebit(const isminefilter& filter) const
|
|
|
|
|
{
|
|
|
|
|
if (vin.empty())
|
|
|
|
|
return 0;
|
|
|
|
@ -654,7 +655,7 @@ public:
|
|
|
|
|
// GetBalance can assume transactions in mapWallet won't change
|
|
|
|
|
if (fUseCache && fCreditCached)
|
|
|
|
|
return nCreditCached;
|
|
|
|
|
nCreditCached = pwallet->GetCredit(*this);
|
|
|
|
|
nCreditCached = pwallet->GetCredit(*this, MINE_SPENDABLE|MINE_WATCH_ONLY);
|
|
|
|
|
fCreditCached = true;
|
|
|
|
|
return nCreditCached;
|
|
|
|
|
}
|
|
|
|
@ -756,12 +757,12 @@ public:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GetAmounts(std::list<std::pair<CTxDestination, int64_t> >& listReceived,
|
|
|
|
|
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) const;
|
|
|
|
|
|
|
|
|
|
void GetAccountAmounts(const std::string& strAccount, int64_t& nReceived,
|
|
|
|
|
int64_t& nSent, int64_t& nFee, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const;
|
|
|
|
|
int64_t& nSent, int64_t& nFee, const isminefilter& filter) const;
|
|
|
|
|
|
|
|
|
|
bool IsFromMe(const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const
|
|
|
|
|
bool IsFromMe(const isminefilter& filter) const
|
|
|
|
|
{
|
|
|
|
|
return (GetDebit(filter) > 0);
|
|
|
|
|
}
|
|
|
|
@ -776,7 +777,7 @@ public:
|
|
|
|
|
return true;
|
|
|
|
|
if (nDepth < 0)
|
|
|
|
|
return false;
|
|
|
|
|
if (!bSpendZeroConfChange || !IsFromMe()) // using wtx's cached debit
|
|
|
|
|
if (!bSpendZeroConfChange || !IsFromMe(MINE_SPENDABLE|MINE_WATCH_ONLY)) // using wtx's cached debit
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// Trusted if all inputs are from us and are in the mempool:
|
|
|
|
|