diff options
Diffstat (limited to 'main.h')
-rw-r--r-- | main.h | 36 |
1 files changed, 7 insertions, 29 deletions
@@ -873,36 +873,11 @@ public: return nChangeCached; } - void GetAccountAmounts(string strAccount, const set<CScript>& setPubKey, - int64& nGenerated, int64& nReceived, int64& nSent, int64& nFee) const - { - nGenerated = nReceived = nSent = nFee = 0; - - // Generated blocks count to account "" - if (IsCoinBase()) - { - if (strAccount == "" && GetBlocksToMaturity() == 0) - nGenerated = GetCredit(); - return; - } - - // Received - foreach(const CTxOut& txout, vout) - if (setPubKey.count(txout.scriptPubKey)) - nReceived += txout.nValue; + void GetAmounts(int64& nGenerated, list<pair<string /* address */, int64> >& listReceived, + int64& nSent, int64& nFee, string& strSentAccount) const; - // Sent - if (strFromAccount == strAccount) - { - int64 nDebit = GetDebit(); - if (nDebit > 0) - { - int64 nValueOut = GetValueOut(); - nFee = nDebit - nValueOut; - nSent = nValueOut - GetChange(); - } - } - } + void GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived, + int64& nSent, int64& nFee) const; bool IsFromMe() const { @@ -1695,6 +1670,7 @@ public: class CAccountingEntry { public: + string strAccount; int64 nCreditDebit; int64 nTime; string strOtherAccount; @@ -1709,6 +1685,7 @@ public: { nCreditDebit = 0; nTime = 0; + strAccount.clear(); strOtherAccount.clear(); strComment.clear(); } @@ -1717,6 +1694,7 @@ public: ( if (!(nType & SER_GETHASH)) READWRITE(nVersion); + // Note: strAccount is serialized as part of the key, not here. READWRITE(nCreditDebit); READWRITE(nTime); READWRITE(strOtherAccount); |