Merge pull request #5146

5b40d88 Update comments in wallet to be doxygen compatible (Michael Ford)
This commit is contained in:
Wladimir J. van der Laan 2014-10-30 17:14:08 +01:00
commit c4761ffb70
No known key found for this signature in database
GPG key ID: 74810B012346C9A6
2 changed files with 125 additions and 89 deletions

View file

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "wallet.h" #include "wallet.h"
@ -22,18 +22,23 @@
using namespace std; using namespace std;
// Settings /**
* Settings
*/
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE); CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
unsigned int nTxConfirmTarget = 1; unsigned int nTxConfirmTarget = 1;
bool bSpendZeroConfChange = true; bool bSpendZeroConfChange = true;
/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */ /**
CFeeRate CWallet::minTxFee = CFeeRate(10000); // Override with -mintxfee * Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)
* Override with -mintxfee
*/
CFeeRate CWallet::minTxFee = CFeeRate(10000);
////////////////////////////////////////////////////////////////////////////// /** @defgroup mapWallet
// *
// mapWallet * @{
// */
struct CompareValueOnly struct CompareValueOnly
{ {
@ -367,8 +372,10 @@ void CWallet::SyncMetaData(pair<TxSpends::iterator, TxSpends::iterator> range)
} }
} }
// Outpoint is spent if any non-conflicted transaction /**
// spends it: * Outpoint is spent if any non-conflicted transaction
* spends it:
*/
bool CWallet::IsSpent(const uint256& hash, unsigned int n) const bool CWallet::IsSpent(const uint256& hash, unsigned int n) const
{ {
const COutPoint outpoint(hash, n); const COutPoint outpoint(hash, n);
@ -477,7 +484,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
{ {
if (!pwalletdbEncryption->TxnCommit()) { if (!pwalletdbEncryption->TxnCommit()) {
delete pwalletdbEncryption; delete pwalletdbEncryption;
// We now have keys encrypted in memory, but no on disk... // We now have keys encrypted in memory, but not on disk...
// die to avoid confusion and let the user reload their unencrypted wallet. // die to avoid confusion and let the user reload their unencrypted wallet.
assert(false); assert(false);
} }
@ -667,9 +674,11 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
return true; return true;
} }
// Add a transaction to the wallet, or update it. /**
// pblock is optional, but should be provided if the transaction is known to be in a block. * Add a transaction to the wallet, or update it.
// If fUpdate is true, existing transactions will be updated. * pblock is optional, but should be provided if the transaction is known to be in a block.
* If fUpdate is true, existing transactions will be updated.
*/
bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate)
{ {
{ {
@ -911,9 +920,11 @@ bool CWalletTx::WriteToDisk()
return CWalletDB(pwallet->strWalletFile).WriteTx(GetHash(), *this); return CWalletDB(pwallet->strWalletFile).WriteTx(GetHash(), *this);
} }
// Scan the block chain (starting in pindexStart) for transactions /**
// from or to us. If fUpdate is true, found transactions that already * Scan the block chain (starting in pindexStart) for transactions
// exist in the wallet will be updated. * from or to us. If fUpdate is true, found transactions that already
* exist in the wallet will be updated.
*/
int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate) int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
{ {
int ret = 0; int ret = 0;
@ -1035,15 +1046,15 @@ void CWallet::ResendWalletTransactions()
} }
} }
/** @} */ // end of mapWallet
/** @defgroup Actions
////////////////////////////////////////////////////////////////////////////// *
// * @{
// Actions */
//
CAmount CWallet::GetBalance() const CAmount CWallet::GetBalance() const
@ -1136,7 +1147,9 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
return nTotal; return nTotal;
} }
// populate vCoins with vector of available COutputs. /**
* populate vCoins with vector of available COutputs.
*/
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl) const void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl) const
{ {
vCoins.clear(); vCoins.clear();
@ -1194,7 +1207,7 @@ static void ApproximateBestSubset(vector<pair<CAmount, pair<const CWalletTx*,uns
//The solver here uses a randomized algorithm, //The solver here uses a randomized algorithm,
//the randomness serves no real security purpose but is just //the randomness serves no real security purpose but is just
//needed to prevent degenerate behavior and it is important //needed to prevent degenerate behavior and it is important
//that the rng fast. We do not use a constant random sequence, //that the rng is fast. We do not use a constant random sequence,
//because there may be some privacy improvement by making //because there may be some privacy improvement by making
//the selection random. //the selection random.
if (nPass == 0 ? insecure_rand()&1 : !vfIncluded[i]) if (nPass == 0 ? insecure_rand()&1 : !vfIncluded[i])
@ -1524,7 +1537,9 @@ bool CWallet::CreateTransaction(CScript scriptPubKey, const CAmount& nValue,
return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet, strFailReason, coinControl); return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet, strFailReason, coinControl);
} }
// Call after CreateTransaction unless you want to abort /**
* Call after CreateTransaction unless you want to abort
*/
bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey) bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
{ {
{ {
@ -1669,7 +1684,7 @@ DBErrors CWallet::ZapWalletTx(std::vector<CWalletTx>& vWtx)
setKeyPool.clear(); setKeyPool.clear();
// Note: can't top-up keypool here, because wallet is locked. // Note: can't top-up keypool here, because wallet is locked.
// User will be prompted to unlock wallet the next operation // User will be prompted to unlock wallet the next operation
// the requires a new key. // that requires a new key.
} }
} }
@ -1736,10 +1751,10 @@ bool CWallet::SetDefaultKey(const CPubKey &vchPubKey)
return true; return true;
} }
// /**
// Mark old keypool keys as used, * Mark old keypool keys as used,
// and generate all new keys * and generate all new keys
// */
bool CWallet::NewKeyPool() bool CWallet::NewKeyPool()
{ {
{ {
@ -2120,6 +2135,7 @@ void CWallet::ListLockedCoins(std::vector<COutPoint>& vOutpts)
} }
} }
/** @} */ // end of Actions
class CAffectedKeysVisitor : public boost::static_visitor<void> { class CAffectedKeysVisitor : public boost::static_visitor<void> {
private: private:

View file

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_WALLET_H #ifndef BITCOIN_WALLET_H
@ -26,16 +26,18 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
// Settings /**
* Settings
*/
extern CFeeRate payTxFee; extern CFeeRate payTxFee;
extern unsigned int nTxConfirmTarget; extern unsigned int nTxConfirmTarget;
extern bool bSpendZeroConfChange; extern bool bSpendZeroConfChange;
// -paytxfee default //! -paytxfee default
static const CAmount DEFAULT_TRANSACTION_FEE = 0; static const CAmount DEFAULT_TRANSACTION_FEE = 0;
// -paytxfee will warn if called with a higher fee than this amount (in satoshis) per KB //! -paytxfee will warn if called with a higher fee than this amount (in satoshis) per KB
static const CAmount nHighTransactionFeeWarning = 0.01 * COIN; static const CAmount nHighTransactionFeeWarning = 0.01 * COIN;
// Largest (in bytes) free transaction we're willing to create //! Largest (in bytes) free transaction we're willing to create
static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
class CAccountingEntry; class CAccountingEntry;
@ -94,7 +96,8 @@ public:
StringMap destdata; StringMap destdata;
}; };
/** A CWallet is an extension of a keystore, which also maintains a set of transactions and balances, /**
* A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,
* and provides the ability to create new transactions. * and provides the ability to create new transactions.
*/ */
class CWallet : public CCryptoKeyStore, public CValidationInterface class CWallet : public CCryptoKeyStore, public CValidationInterface
@ -104,18 +107,20 @@ private:
CWalletDB *pwalletdbEncryption; CWalletDB *pwalletdbEncryption;
// the current wallet version: clients below this version are not able to load the wallet //! the current wallet version: clients below this version are not able to load the wallet
int nWalletVersion; int nWalletVersion;
// the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded //! the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded
int nWalletMaxVersion; int nWalletMaxVersion;
int64_t nNextResend; int64_t nNextResend;
int64_t nLastResend; int64_t nLastResend;
// Used to keep track of spent outpoints, and /**
// detect and report conflicts (double-spends or * Used to keep track of spent outpoints, and
// mutated transactions where the mutant gets mined). * detect and report conflicts (double-spends or
* mutated transactions where the mutant gets mined).
*/
typedef std::multimap<COutPoint, uint256> TxSpends; typedef std::multimap<COutPoint, uint256> TxSpends;
TxSpends mapTxSpends; TxSpends mapTxSpends;
void AddToSpends(const COutPoint& outpoint, const uint256& wtxid); void AddToSpends(const COutPoint& outpoint, const uint256& wtxid);
@ -124,11 +129,13 @@ private:
void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>); void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>);
public: public:
/// Main wallet lock. /*
/// This lock protects all the fields added by CWallet * Main wallet lock.
/// except for: * This lock protects all the fields added by CWallet
/// fFileBacked (immutable after instantiation) * except for:
/// strWalletFile (immutable after instantiation) * fFileBacked (immutable after instantiation)
* strWalletFile (immutable after instantiation)
*/
mutable CCriticalSection cs_wallet; mutable CCriticalSection cs_wallet;
bool fFileBacked; bool fFileBacked;
@ -188,7 +195,7 @@ public:
const CWalletTx* GetWalletTx(const uint256& hash) const; const CWalletTx* GetWalletTx(const uint256& hash) const;
// check whether we are allowed to upgrade (or already support) to the named feature //! check whether we are allowed to upgrade (or already support) to the named feature
bool CanSupportFeature(enum WalletFeature wf) { AssertLockHeld(cs_wallet); return nWalletMaxVersion >= wf; } bool CanSupportFeature(enum WalletFeature wf) { AssertLockHeld(cs_wallet); return nWalletMaxVersion >= wf; }
void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl = NULL) const; void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl = NULL) const;
@ -202,38 +209,40 @@ public:
void UnlockAllCoins(); void UnlockAllCoins();
void ListLockedCoins(std::vector<COutPoint>& vOutpts); void ListLockedCoins(std::vector<COutPoint>& vOutpts);
// keystore implementation /**
// Generate a new key * keystore implementation
* Generate a new key
*/
CPubKey GenerateNewKey(); CPubKey GenerateNewKey();
// Adds a key to the store, and saves it to disk. //! Adds a key to the store, and saves it to disk.
bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey); bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey);
// Adds a key to the store, without saving it to disk (used by LoadWallet) //! Adds a key to the store, without saving it to disk (used by LoadWallet)
bool LoadKey(const CKey& key, const CPubKey &pubkey) { return CCryptoKeyStore::AddKeyPubKey(key, pubkey); } bool LoadKey(const CKey& key, const CPubKey &pubkey) { return CCryptoKeyStore::AddKeyPubKey(key, pubkey); }
// Load metadata (used by LoadWallet) //! Load metadata (used by LoadWallet)
bool LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &metadata); bool LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &metadata);
bool LoadMinVersion(int nVersion) { AssertLockHeld(cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; } bool LoadMinVersion(int nVersion) { AssertLockHeld(cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; }
// Adds an encrypted key to the store, and saves it to disk. //! Adds an encrypted key to the store, and saves it to disk.
bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret); bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
// Adds an encrypted key to the store, without saving it to disk (used by LoadWallet) //! Adds an encrypted key to the store, without saving it to disk (used by LoadWallet)
bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret); bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
bool AddCScript(const CScript& redeemScript); bool AddCScript(const CScript& redeemScript);
bool LoadCScript(const CScript& redeemScript); bool LoadCScript(const CScript& redeemScript);
/// Adds a destination data tuple to the store, and saves it to disk //! Adds a destination data tuple to the store, and saves it to disk
bool AddDestData(const CTxDestination &dest, const std::string &key, const std::string &value); bool AddDestData(const CTxDestination &dest, const std::string &key, const std::string &value);
/// Erases a destination data tuple in the store and on disk //! Erases a destination data tuple in the store and on disk
bool EraseDestData(const CTxDestination &dest, const std::string &key); bool EraseDestData(const CTxDestination &dest, const std::string &key);
/// Adds a destination data tuple to the store, without saving it to disk //! Adds a destination data tuple to the store, without saving it to disk
bool LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value); bool LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value);
/// Look up a destination data tuple in the store, return true if found false otherwise //! Look up a destination data tuple in the store, return true if found false otherwise
bool GetDestData(const CTxDestination &dest, const std::string &key, std::string *value) const; bool GetDestData(const CTxDestination &dest, const std::string &key, std::string *value) const;
// 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); 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);
bool Unlock(const SecureString& strWalletPassphrase); bool Unlock(const SecureString& strWalletPassphrase);
@ -242,17 +251,19 @@ public:
void GetKeyBirthTimes(std::map<CKeyID, int64_t> &mapKeyBirth) const; void GetKeyBirthTimes(std::map<CKeyID, int64_t> &mapKeyBirth) const;
/** Increment the next transaction order id /**
@return next transaction order id * Increment the next transaction order id
* @return next transaction order id
*/ */
int64_t IncOrderPosNext(CWalletDB *pwalletdb = NULL); int64_t IncOrderPosNext(CWalletDB *pwalletdb = NULL);
typedef std::pair<CWalletTx*, CAccountingEntry*> TxPair; typedef std::pair<CWalletTx*, CAccountingEntry*> TxPair;
typedef std::multimap<int64_t, TxPair > TxItems; typedef std::multimap<int64_t, TxPair > TxItems;
/** Get the wallet's activity log /**
@return multimap of ordered transactions and accounting entries * Get the wallet's activity log
@warning Returned pointers are *only* valid within the scope of passed acentries * @return multimap of ordered transactions and accounting entries
* @warning Returned pointers are *only* valid within the scope of passed acentries
*/ */
TxItems OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount = ""); TxItems OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount = "");
@ -320,7 +331,8 @@ public:
return true; return true;
return false; return false;
} }
bool IsFromMe(const CTransaction& tx) const // should probably be renamed to IsRelevantToMe /** should probably be renamed to IsRelevantToMe */
bool IsFromMe(const CTransaction& tx) const
{ {
return (GetDebit(tx, ISMINE_ALL) > 0); return (GetDebit(tx, ISMINE_ALL) > 0);
} }
@ -386,19 +398,20 @@ public:
bool SetDefaultKey(const CPubKey &vchPubKey); bool SetDefaultKey(const CPubKey &vchPubKey);
// signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVersion if those are lower //! signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVersion if those are lower
bool SetMinVersion(enum WalletFeature, CWalletDB* pwalletdbIn = NULL, bool fExplicit = false); bool SetMinVersion(enum WalletFeature, CWalletDB* pwalletdbIn = NULL, bool fExplicit = false);
// change which version we're allowed to upgrade to (note that this does not immediately imply upgrading to that format) //! change which version we're allowed to upgrade to (note that this does not immediately imply upgrading to that format)
bool SetMaxVersion(int nVersion); bool SetMaxVersion(int nVersion);
// get the current wallet format (the oldest client version guaranteed to understand this wallet) //! get the current wallet format (the oldest client version guaranteed to understand this wallet)
int GetVersion() { LOCK(cs_wallet); return nWalletVersion; } int GetVersion() { LOCK(cs_wallet); return nWalletVersion; }
// Get wallet transactions that conflict with given transaction (spend same outputs) //! Get wallet transactions that conflict with given transaction (spend same outputs)
std::set<uint256> GetConflicts(const uint256& txid) const; std::set<uint256> GetConflicts(const uint256& txid) const;
/** Address book entry changed. /**
* Address book entry changed.
* @note called with lock cs_wallet held. * @note called with lock cs_wallet held.
*/ */
boost::signals2::signal<void (CWallet *wallet, const CTxDestination boost::signals2::signal<void (CWallet *wallet, const CTxDestination
@ -406,7 +419,8 @@ public:
const std::string &purpose, const std::string &purpose,
ChangeType status)> NotifyAddressBookChanged; ChangeType status)> NotifyAddressBookChanged;
/** Wallet transaction added, removed or updated. /**
* Wallet transaction added, removed or updated.
* @note called with lock cs_wallet held. * @note called with lock cs_wallet held.
*/ */
boost::signals2::signal<void (CWallet *wallet, const uint256 &hashTx, boost::signals2::signal<void (CWallet *wallet, const uint256 &hashTx,
@ -517,10 +531,13 @@ public:
int SetMerkleBranch(const CBlock& block); int SetMerkleBranch(const CBlock& block);
// Return depth of transaction in blockchain:
// -1 : not in blockchain, and not in memory pool (conflicted transaction) /**
// 0 : in memory pool, waiting to be included in a block * Return depth of transaction in blockchain:
// >=1 : this many blocks deep in the main chain * -1 : not in blockchain, and not in memory pool (conflicted transaction)
* 0 : in memory pool, waiting to be included in a block
* >=1 : this many blocks deep in the main chain
*/
int GetDepthInMainChain(const CBlockIndex* &pindexRet) const; int GetDepthInMainChain(const CBlockIndex* &pindexRet) const;
int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); } int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; } bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
@ -528,7 +545,8 @@ public:
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectInsaneFee=true); bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectInsaneFee=true);
}; };
/** A transaction with a bunch of additional info that only the owner cares about. /**
* A transaction with a bunch of additional info that only the owner cares about.
* It includes any unrecorded transactions needed to link it back to the block chain. * It includes any unrecorded transactions needed to link it back to the block chain.
*/ */
class CWalletTx : public CMerkleTx class CWalletTx : public CMerkleTx
@ -540,11 +558,11 @@ public:
mapValue_t mapValue; mapValue_t mapValue;
std::vector<std::pair<std::string, std::string> > vOrderForm; std::vector<std::pair<std::string, std::string> > vOrderForm;
unsigned int fTimeReceivedIsTxTime; unsigned int fTimeReceivedIsTxTime;
unsigned int nTimeReceived; // time received by this node unsigned int nTimeReceived; //! time received by this node
unsigned int nTimeSmart; unsigned int nTimeSmart;
char fFromMe; char fFromMe;
std::string strFromAccount; std::string strFromAccount;
int64_t nOrderPos; // position in ordered transaction list int64_t nOrderPos; //! position in ordered transaction list
// memory only // memory only
mutable bool fDebitCached; mutable bool fDebitCached;
@ -636,7 +654,7 @@ public:
} }
READWRITE(*(CMerkleTx*)this); READWRITE(*(CMerkleTx*)this);
std::vector<CMerkleTx> vUnused; // Used to be vtxPrev std::vector<CMerkleTx> vUnused; //! Used to be vtxPrev
READWRITE(vUnused); READWRITE(vUnused);
READWRITE(mapValue); READWRITE(mapValue);
READWRITE(vOrderForm); READWRITE(vOrderForm);
@ -661,7 +679,7 @@ public:
mapValue.erase("timesmart"); mapValue.erase("timesmart");
} }
// make sure balances are recalculated //! make sure balances are recalculated
void MarkDirty() void MarkDirty()
{ {
fCreditCached = false; fCreditCached = false;
@ -680,7 +698,7 @@ public:
MarkDirty(); MarkDirty();
} }
// filter decides which addresses will count towards the debit //! filter decides which addresses will count towards the debit
CAmount GetDebit(const isminefilter& filter) const CAmount GetDebit(const isminefilter& filter) const
{ {
if (vin.empty()) if (vin.empty())
@ -919,8 +937,8 @@ public:
int64_t nTimeCreated; int64_t nTimeCreated;
int64_t nTimeExpires; int64_t nTimeExpires;
std::string strComment; std::string strComment;
//// todo: add something to note what created it (user, getnewaddress, change) //! todo: add something to note what created it (user, getnewaddress, change)
//// maybe should have a map<string, string> property map //! maybe should have a map<string, string> property map
CWalletKey(int64_t nExpires=0); CWalletKey(int64_t nExpires=0);
@ -942,7 +960,8 @@ public:
/** Account information. /**
* Account information.
* Stored in wallet with key "acc"+string account name. * Stored in wallet with key "acc"+string account name.
*/ */
class CAccount class CAccount
@ -972,7 +991,8 @@ public:
/** Internal transfers. /**
* Internal transfers.
* Database key is acentry<account><counter>. * Database key is acentry<account><counter>.
*/ */
class CAccountingEntry class CAccountingEntry
@ -984,7 +1004,7 @@ public:
std::string strOtherAccount; std::string strOtherAccount;
std::string strComment; std::string strComment;
mapValue_t mapValue; mapValue_t mapValue;
int64_t nOrderPos; // position in ordered transaction list int64_t nOrderPos; //! position in ordered transaction list
uint64_t nEntryNo; uint64_t nEntryNo;
CAccountingEntry() CAccountingEntry()
@ -1009,7 +1029,7 @@ public:
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
if (!(nType & SER_GETHASH)) if (!(nType & SER_GETHASH))
READWRITE(nVersion); READWRITE(nVersion);
// Note: strAccount is serialized as part of the key, not here. //! Note: strAccount is serialized as part of the key, not here.
READWRITE(nCreditDebit); READWRITE(nCreditDebit);
READWRITE(nTime); READWRITE(nTime);
READWRITE(LIMITED_STRING(strOtherAccount, 65536)); READWRITE(LIMITED_STRING(strOtherAccount, 65536));