Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
CWallet Class Reference

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. More...

#include <wallet.h>

+ Inheritance diagram for CWallet:
+ Collaboration diagram for CWallet:

Public Types

typedef std::map< unsigned int, CMasterKeyMasterKeyMap
 
typedef std::pair< CWalletTx *, CAccountingEntry * > TxPair
 
typedef std::multimap< int64_t, TxPairTxItems
 

Public Member Functions

 CWallet ()
 
 CWallet (std::string strWalletFileIn)
 
void SetNull ()
 
const CWalletTxGetWalletTx (const uint256 &hash) const
 
bool CanSupportFeature (enum WalletFeature wf)
 
void AvailableCoins (std::vector< COutput > &vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl=NULL) const
 
bool SelectCoinsMinConf (int64_t nTargetValue, int nConfMine, int nConfTheirs, std::vector< COutput > vCoins, std::set< std::pair< const CWalletTx *, unsigned int > > &setCoinsRet, int64_t &nValueRet) const
 
bool IsSpent (const uint256 &hash, unsigned int n) const
 
bool IsLockedCoin (uint256 hash, unsigned int n) const
 
void LockCoin (COutPoint &output)
 
void UnlockCoin (COutPoint &output)
 
void UnlockAllCoins ()
 
void ListLockedCoins (std::vector< COutPoint > &vOutpts)
 
CPubKey GenerateNewKey ()
 
bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey)
 
bool LoadKey (const CKey &key, const CPubKey &pubkey)
 
bool LoadKeyMetadata (const CPubKey &pubkey, const CKeyMetadata &metadata)
 
bool LoadMinVersion (int nVersion)
 
bool AddCryptedKey (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 LoadCScript (const CScript &redeemScript)
 
bool AddDestData (const CTxDestination &dest, const std::string &key, const std::string &value)
 Adds a destination data tuple to the store, and saves it to disk. More...
 
bool EraseDestData (const CTxDestination &dest, const std::string &key)
 Erases a destination data tuple in the store and on disk. More...
 
bool LoadDestData (const CTxDestination &dest, const std::string &key, const std::string &value)
 Adds a destination data tuple to the store, without saving it to disk. More...
 
bool GetDestData (const CTxDestination &dest, const std::string &key, std::string *value) const
 Look up a destination data tuple in the store, return true if found false otherwise. More...
 
bool Unlock (const SecureString &strWalletPassphrase)
 
bool ChangeWalletPassphrase (const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
 
bool EncryptWallet (const SecureString &strWalletPassphrase)
 
void GetKeyBirthTimes (std::map< CKeyID, int64_t > &mapKeyBirth) const
 
int64_t IncOrderPosNext (CWalletDB *pwalletdb=NULL)
 Increment the next transaction order id. More...
 
TxItems OrderedTxItems (std::list< CAccountingEntry > &acentries, std::string strAccount="")
 Get the wallet's activity log. More...
 
void MarkDirty ()
 
bool AddToWallet (const CWalletTx &wtxIn, bool fFromLoadWallet=false)
 
void SyncTransaction (const uint256 &hash, const CTransaction &tx, const CBlock *pblock)
 
bool AddToWalletIfInvolvingMe (const uint256 &hash, const CTransaction &tx, const CBlock *pblock, bool fUpdate)
 
void EraseFromWallet (const uint256 &hash)
 
int ScanForWalletTransactions (CBlockIndex *pindexStart, bool fUpdate=false)
 
void ReacceptWalletTransactions ()
 
void ResendWalletTransactions ()
 
int64_t GetBalance () const
 
int64_t GetUnconfirmedBalance () const
 
int64_t GetImmatureBalance () const
 
bool CreateTransaction (const std::vector< std::pair< CScript, int64_t > > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, int64_t &nFeeRet, std::string &strFailReason, const CCoinControl *coinControl=NULL)
 
bool CreateTransaction (CScript scriptPubKey, int64_t nValue, CWalletTx &wtxNew, CReserveKey &reservekey, int64_t &nFeeRet, std::string &strFailReason, const CCoinControl *coinControl=NULL)
 
bool CommitTransaction (CWalletTx &wtxNew, CReserveKey &reservekey)
 
std::string SendMoney (CScript scriptPubKey, int64_t nValue, CWalletTx &wtxNew)
 
std::string SendMoneyToDestination (const CTxDestination &address, int64_t nValue, CWalletTx &wtxNew)
 
bool NewKeyPool ()
 
bool TopUpKeyPool (unsigned int kpSize=0)
 
int64_t AddReserveKey (const CKeyPool &keypool)
 
void ReserveKeyFromKeyPool (int64_t &nIndex, CKeyPool &keypool)
 
void KeepKey (int64_t nIndex)
 
void ReturnKey (int64_t nIndex)
 
bool GetKeyFromPool (CPubKey &key)
 
int64_t GetOldestKeyPoolTime ()
 
void GetAllReserveKeys (std::set< CKeyID > &setAddress) const
 
std::set< std::set< CTxDestination > > GetAddressGroupings ()
 
std::map< CTxDestination, int64_t > GetAddressBalances ()
 
std::set< CTxDestinationGetAccountAddresses (std::string strAccount) const
 
bool IsMine (const CTxIn &txin) const
 
int64_t GetDebit (const CTxIn &txin) const
 
bool IsMine (const CTxOut &txout) const
 
int64_t GetCredit (const CTxOut &txout) const
 
bool IsChange (const CTxOut &txout) const
 
int64_t GetChange (const CTxOut &txout) const
 
bool IsMine (const CTransaction &tx) const
 
bool IsFromMe (const CTransaction &tx) const
 
int64_t GetDebit (const CTransaction &tx) const
 
int64_t GetCredit (const CTransaction &tx) const
 
int64_t GetChange (const CTransaction &tx) const
 
void SetBestChain (const CBlockLocator &loc)
 
DBErrors LoadWallet (bool &fFirstRunRet)
 
DBErrors ZapWalletTx ()
 
bool SetAddressBook (const CTxDestination &address, const std::string &strName, const std::string &purpose)
 
bool DelAddressBook (const CTxDestination &address)
 
void UpdatedTransaction (const uint256 &hashTx)
 
void Inventory (const uint256 &hash)
 
unsigned int GetKeyPoolSize ()
 
bool SetDefaultKey (const CPubKey &vchPubKey)
 
bool SetMinVersion (enum WalletFeature, CWalletDB *pwalletdbIn=NULL, bool fExplicit=false)
 
bool SetMaxVersion (int nVersion)
 
int GetVersion ()
 
std::set< uint256GetConflicts (const uint256 &txid) const
 
- Public Member Functions inherited from CCryptoKeyStore
 CCryptoKeyStore ()
 
bool IsCrypted () const
 
bool IsLocked () const
 
bool Lock ()
 
bool HaveKey (const CKeyID &address) const
 
bool GetKey (const CKeyID &address, CKey &keyOut) const
 
bool GetPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const
 
void GetKeys (std::set< CKeyID > &setAddress) const
 
- Public Member Functions inherited from CBasicKeyStore
bool HaveKey (const CKeyID &address) const
 
void GetKeys (std::set< CKeyID > &setAddress) const
 
bool GetKey (const CKeyID &address, CKey &keyOut) const
 
virtual bool HaveCScript (const CScriptID &hash) const
 
virtual bool GetCScript (const CScriptID &hash, CScript &redeemScriptOut) const
 
- Public Member Functions inherited from CKeyStore
virtual ~CKeyStore ()
 
virtual bool AddKey (const CKey &key)
 

Public Attributes

CCriticalSection cs_wallet
 Main wallet lock. More...
 
bool fFileBacked
 
std::string strWalletFile
 
std::set< int64_t > setKeyPool
 
std::map< CKeyID, CKeyMetadatamapKeyMetadata
 
MasterKeyMap mapMasterKeys
 
unsigned int nMasterKeyMaxID
 
std::map< uint256, CWalletTxmapWallet
 
int64_t nOrderPosNext
 
std::map< uint256, intmapRequestCount
 
std::map< CTxDestination, CAddressBookDatamapAddressBook
 
CPubKey vchDefaultKey
 
std::set< COutPointsetLockedCoins
 
int64_t nTimeFirstKey
 
boost::signals2::signal< void(CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)> NotifyAddressBookChanged
 Address book entry changed. More...
 
boost::signals2::signal< void(CWallet *wallet, const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged
 Wallet transaction added, removed or updated. More...
 
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
 Show progress e.g. More...
 
- Public Attributes inherited from CCryptoKeyStore
boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
 

Private Types

typedef std::multimap< COutPoint, uint256TxSpends
 

Private Member Functions

bool SelectCoins (int64_t nTargetValue, std::set< std::pair< const CWalletTx *, unsigned int > > &setCoinsRet, int64_t &nValueRet, const CCoinControl *coinControl=NULL) const
 
void AddToSpends (const COutPoint &outpoint, const uint256 &wtxid)
 
void AddToSpends (const uint256 &wtxid)
 
void SyncMetaData (std::pair< TxSpends::iterator, TxSpends::iterator >)
 

Private Attributes

CWalletDBpwalletdbEncryption
 
int nWalletVersion
 
int nWalletMaxVersion
 
int64_t nNextResend
 
int64_t nLastResend
 
TxSpends mapTxSpends
 

Additional Inherited Members

- Protected Member Functions inherited from CCryptoKeyStore
bool SetCrypted ()
 
bool EncryptKeys (CKeyingMaterial &vMasterKeyIn)
 
bool Unlock (const CKeyingMaterial &vMasterKeyIn)
 
- Protected Member Functions inherited from CWalletInterface
friend void::RegisterWallet (CWalletInterface *)
 
friend void::UnregisterWallet (CWalletInterface *)
 
friend void::UnregisterAllWallets ()
 
- Protected Attributes inherited from CBasicKeyStore
KeyMap mapKeys
 
ScriptMap mapScripts
 
- Protected Attributes inherited from CKeyStore
CCriticalSection cs_KeyStore
 

Detailed Description

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.

Definition at line 100 of file wallet.h.

Member Typedef Documentation

typedef std::map<unsigned int, CMasterKey> CWallet::MasterKeyMap

Definition at line 140 of file wallet.h.

typedef std::multimap<int64_t, TxPair > CWallet::TxItems

Definition at line 237 of file wallet.h.

Definition at line 236 of file wallet.h.

typedef std::multimap<COutPoint, uint256> CWallet::TxSpends
private

Definition at line 119 of file wallet.h.

Constructor & Destructor Documentation

CWallet::CWallet ( )
inline

Definition at line 144 of file wallet.h.

CWallet::CWallet ( std::string  strWalletFileIn)
inline

Definition at line 148 of file wallet.h.

Member Function Documentation

bool CWallet::AddCryptedKey ( const CPubKey vchPubKey,
const std::vector< unsigned char > &  vchCryptedSecret 
)
virtual

Reimplemented from CCryptoKeyStore.

Definition at line 86 of file wallet.cpp.

References CCryptoKeyStore::AddCryptedKey(), CPubKey::GetID(), LOCK, strWalletFile, and CWalletDB::WriteCryptedKey().

+ Here is the call graph for this function:

bool CWallet::AddCScript ( const CScript redeemScript)
virtual

Reimplemented from CBasicKeyStore.

Definition at line 122 of file wallet.cpp.

References CBasicKeyStore::AddCScript(), Hash160(), strWalletFile, and CWalletDB::WriteCScript().

Referenced by addmultisigaddress().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::AddDestData ( const CTxDestination dest,
const std::string &  key,
const std::string &  value 
)

Adds a destination data tuple to the store, and saves it to disk.

Definition at line 2059 of file wallet.cpp.

References strWalletFile, and CWalletDB::WriteDestData().

Referenced by WalletModel::saveReceiveRequest().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::AddKeyPubKey ( const CKey key,
const CPubKey pubkey 
)
virtual

Reimplemented from CCryptoKeyStore.

Definition at line 71 of file wallet.cpp.

References CCryptoKeyStore::AddKeyPubKey(), AssertLockHeld, CPubKey::GetID(), CKey::GetPrivKey(), strWalletFile, and CWalletDB::WriteKey().

Referenced by importprivkey(), and importwallet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t CWallet::AddReserveKey ( const CKeyPool keypool)

Definition at line 1690 of file wallet.cpp.

References cs_main, LOCK2, strWalletFile, and CWalletDB::WritePool().

+ Here is the call graph for this function:

void CWallet::AddToSpends ( const COutPoint outpoint,
const uint256 wtxid 
)
private

Definition at line 335 of file wallet.cpp.

void CWallet::AddToSpends ( const uint256 wtxid)
private

Definition at line 345 of file wallet.cpp.

References CTxIn::prevout.

bool CWallet::AddToWallet ( const CWalletTx wtxIn,
bool  fFromLoadWallet = false 
)

Definition at line 483 of file wallet.cpp.

References CWalletTx::BindWallet(), CT_NEW, CT_UPDATED, CWalletTx::fFromMe, GetAdjustedTime(), GetArg(), CTransaction::GetHash(), base_uint< BITS >::GetHex(), CMerkleTx::hashBlock, LOCK, LogPrintf, mapBlockIndex, CMerkleTx::nIndex, CWalletTx::nOrderPos, NotifyTransactionChanged(), CAccountingEntry::nTime, CWalletTx::nTimeReceived, CWalletTx::nTimeSmart, runCommand(), base_uint< BITS >::ToString(), CMerkleTx::vMerkleBranch, and CWalletTx::WriteToDisk().

Referenced by ReadKeyValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::AddToWalletIfInvolvingMe ( const uint256 hash,
const CTransaction tx,
const CBlock pblock,
bool  fUpdate 
)

Definition at line 606 of file wallet.cpp.

References AssertLockHeld, and IsMine().

+ Here is the call graph for this function:

void CWallet::AvailableCoins ( std::vector< COutput > &  vCoins,
bool  fOnlyConfirmed = true,
const CCoinControl coinControl = NULL 
) const

Definition at line 1026 of file wallet.cpp.

References cs_main, CMerkleTx::GetBlocksToMaturity(), CMerkleTx::GetDepthInMainChain(), CCoinControl::HasSelected(), CTransaction::IsCoinBase(), IsFinalTx(), IsMine(), CCoinControl::IsSelected(), CWalletTx::IsTrusted(), LOCK2, and CTransaction::vout.

Referenced by WalletModel::getBalance(), and WalletModel::listCoins().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::CanSupportFeature ( enum WalletFeature  wf)
inline

Definition at line 184 of file wallet.h.

References AssertLockHeld.

bool CWallet::ChangeWalletPassphrase ( const SecureString strOldWalletPassphrase,
const SecureString strNewWalletPassphrase 
)

Definition at line 167 of file wallet.cpp.

References CCrypter::Decrypt(), CCrypter::Encrypt(), GetTimeMillis(), LOCK, LogPrintf, CCrypter::SetKeyFromPassphrase(), strWalletFile, CCryptoKeyStore::Unlock(), and CWalletDB::WriteMasterKey().

Referenced by WalletModel::changePassphrase(), and walletpassphrasechange().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::CommitTransaction ( CWalletTx wtxNew,
CReserveKey reservekey 
)

Definition at line 1401 of file wallet.cpp.

References CMerkleTx::AcceptToMemoryPool(), CWalletTx::BindWallet(), cs_main, CT_UPDATED, CTransaction::GetHash(), COutPoint::hash, CReserveKey::KeepKey(), LOCK2, LogPrintf, NotifyTransactionChanged(), CTxIn::prevout, CWalletTx::RelayWalletTransaction(), strWalletFile, CTransaction::ToString(), and CTransaction::vin.

Referenced by mastercore::ClassB_send(), WalletModel::sendCoins(), and sendmany().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::CreateTransaction ( const std::vector< std::pair< CScript, int64_t > > &  vecSend,
CWalletTx wtxNew,
CReserveKey reservekey,
int64_t &  nFeeRet,
std::string &  strFailReason,
const CCoinControl coinControl = NULL 
)

Referenced by mastercore::ClassB_send(), WalletModel::prepareTransaction(), and sendmany().

+ Here is the caller graph for this function:

bool CWallet::CreateTransaction ( CScript  scriptPubKey,
int64_t  nValue,
CWalletTx wtxNew,
CReserveKey reservekey,
int64_t &  nFeeRet,
std::string &  strFailReason,
const CCoinControl coinControl = NULL 
)

Definition at line 1392 of file wallet.cpp.

bool CWallet::DelAddressBook ( const CTxDestination address)

Definition at line 1568 of file wallet.cpp.

References CT_DELETED, CWalletDB::EraseDestData(), CWalletDB::EraseName(), CWalletDB::ErasePurpose(), IsMine(), LOCK, NotifyAddressBookChanged(), PAIRTYPE, strWalletFile, and CBase58Data::ToString().

Referenced by AddressTableModel::removeRows(), and AddressTableModel::setData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::EncryptWallet ( const SecureString strWalletPassphrase)

Definition at line 356 of file wallet.cpp.

References CCrypter::Encrypt(), FEATURE_WALLETCRYPT, GetTimeMillis(), LOCK, LogPrintf, CMasterKey::nDerivationMethod, CMasterKey::nDeriveIterations, RandAddSeedPerfmon(), CDB::Rewrite(), CCrypter::SetKeyFromPassphrase(), strWalletFile, CMasterKey::vchCryptedKey, CMasterKey::vchSalt, WALLET_CRYPTO_KEY_SIZE, and WALLET_CRYPTO_SALT_SIZE.

Referenced by encryptwallet(), and WalletModel::setWalletEncrypted().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::EraseDestData ( const CTxDestination dest,
const std::string &  key 
)

Erases a destination data tuple in the store and on disk.

Definition at line 2070 of file wallet.cpp.

References CWalletDB::EraseDestData(), and strWalletFile.

Referenced by WalletModel::saveReceiveRequest().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::EraseFromWallet ( const uint256 hash)
virtual

Implements CWalletInterface.

Definition at line 640 of file wallet.cpp.

References CWalletDB::EraseTx(), LOCK, and strWalletFile.

+ Here is the call graph for this function:

CPubKey CWallet::GenerateNewKey ( )

Definition at line 45 of file wallet.cpp.

References AssertLockHeld, FEATURE_COMPRPUBKEY, CPubKey::GetID(), CKey::GetPubKey(), GetTime(), CKey::MakeNewKey(), and RandAddSeedPerfmon().

+ Here is the call graph for this function:

set< CTxDestination > CWallet::GetAccountAddresses ( std::string  strAccount) const

Definition at line 1889 of file wallet.cpp.

References AssertLockHeld, CAddressBookData::name, and PAIRTYPE.

Referenced by PaymentServer::fetchPaymentACK(), and getreceivedbyaccount().

+ Here is the caller graph for this function:

std::map< CTxDestination, int64_t > CWallet::GetAddressBalances ( )

Definition at line 1756 of file wallet.cpp.

References ExtractDestination(), CMerkleTx::GetBlocksToMaturity(), CMerkleTx::GetDepthInMainChain(), CTransaction::IsCoinBase(), IsFinalTx(), CWalletTx::IsFromMe(), IsMine(), CWalletTx::IsTrusted(), LOCK, PAIRTYPE, and CTransaction::vout.

Referenced by listaddressgroupings().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

set< set< CTxDestination > > CWallet::GetAddressGroupings ( )

Definition at line 1796 of file wallet.cpp.

References AssertLockHeld, ExtractDestination(), COutPoint::hash, IsMine(), COutPoint::n, PAIRTYPE, CTxIn::prevout, CTxOut::scriptPubKey, CTransaction::vin, and CTransaction::vout.

Referenced by listaddressgroupings().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::GetAllReserveKeys ( std::set< CKeyID > &  setAddress) const

Definition at line 1940 of file wallet.cpp.

References cs_main, CPubKey::GetID(), CPubKey::IsValid(), LOCK2, CWalletDB::ReadPool(), strWalletFile, and CKeyPool::vchPubKey.

Referenced by dumpwallet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t CWallet::GetBalance ( ) const

Definition at line 980 of file wallet.cpp.

References cs_main, CWalletTx::GetAvailableCredit(), CWalletTx::IsTrusted(), and LOCK2.

Referenced by WalletModel::getBalance(), getbalance(), getinfo(), and getwalletinfo().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t CWallet::GetChange ( const CTxOut txout) const
inline

Definition at line 292 of file wallet.h.

References MoneyRange(), and CTxOut::nValue.

Referenced by CWalletTx::GetChange().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t CWallet::GetChange ( const CTransaction tx) const
inline

Definition at line 331 of file wallet.h.

References MoneyRange(), and CTransaction::vout.

+ Here is the call graph for this function:

set< uint256 > CWallet::GetConflicts ( const uint256 txid) const

Definition at line 258 of file wallet.cpp.

References AssertLockHeld, CTxIn::prevout, and CTransaction::vin.

int64_t CWallet::GetCredit ( const CTxOut txout) const
inline

Definition at line 285 of file wallet.h.

References IsMine(), MoneyRange(), and CTxOut::nValue.

Referenced by CWalletTx::GetAvailableCredit(), CWalletTx::GetCredit(), CWalletTx::GetImmatureCredit(), and TransactionDesc::toHTML().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t CWallet::GetCredit ( const CTransaction tx) const
inline

Definition at line 320 of file wallet.h.

References MoneyRange(), and CTransaction::vout.

+ Here is the call graph for this function:

int64_t CWallet::GetDebit ( const CTxIn txin) const

Definition at line 669 of file wallet.cpp.

References COutPoint::hash, IsMine(), LOCK, COutPoint::n, CTxIn::prevout, and CTransaction::vout.

Referenced by CWalletTx::GetDebit(), and TransactionDesc::toHTML().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t CWallet::GetDebit ( const CTransaction tx) const
inline

Definition at line 309 of file wallet.h.

References MoneyRange(), and CTransaction::vin.

+ Here is the call graph for this function:

bool CWallet::GetDestData ( const CTxDestination dest,
const std::string &  key,
std::string *  value 
) const

Look up a destination data tuple in the store, return true if found false otherwise.

Definition at line 2085 of file wallet.cpp.

int64_t CWallet::GetImmatureBalance ( ) const

Definition at line 1011 of file wallet.cpp.

References cs_main, CWalletTx::GetImmatureCredit(), and LOCK2.

Referenced by WalletModel::getImmatureBalance().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::GetKeyBirthTimes ( std::map< CKeyID, int64_t > &  mapKeyBirth) const

Definition at line 2007 of file wallet.cpp.

References AssertLockHeld, chainActive, CChain::Contains(), ExtractAffectedKeys(), CMerkleTx::hashBlock, CChain::Height(), mapBlockIndex, CTxOut::scriptPubKey, and CTransaction::vout.

Referenced by dumpwallet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::GetKeyFromPool ( CPubKey key)

Definition at line 1726 of file wallet.cpp.

References LOCK, and CKeyPool::vchPubKey.

Referenced by AddressTableModel::addRow(), AppInit2(), PaymentServer::fetchPaymentACK(), GetAccountAddress(), and getnewaddress().

+ Here is the caller graph for this function:

unsigned int CWallet::GetKeyPoolSize ( )
inline

Definition at line 363 of file wallet.h.

References AssertLockHeld.

Referenced by getinfo(), getwalletinfo(), and keypoolrefill().

+ Here is the caller graph for this function:

int64_t CWallet::GetOldestKeyPoolTime ( )

Definition at line 1745 of file wallet.cpp.

References GetTime(), and CKeyPool::nTime.

Referenced by getinfo(), and getwalletinfo().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t CWallet::GetUnconfirmedBalance ( ) const

Definition at line 996 of file wallet.cpp.

References cs_main, CWalletTx::GetAvailableCredit(), CMerkleTx::GetDepthInMainChain(), IsFinalTx(), CWalletTx::IsTrusted(), and LOCK2.

Referenced by WalletModel::getUnconfirmedBalance(), and getunconfirmedbalance().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int CWallet::GetVersion ( )
inline

Definition at line 378 of file wallet.h.

References LOCK.

Referenced by getinfo(), and getwalletinfo().

+ Here is the caller graph for this function:

const CWalletTx * CWallet::GetWalletTx ( const uint256 hash) const

Definition at line 36 of file wallet.cpp.

References LOCK.

Referenced by CWalletTx::IsTrusted().

+ Here is the caller graph for this function:

int64_t CWallet::IncOrderPosNext ( CWalletDB pwalletdb = NULL)

Increment the next transaction order id.

Returns
next transaction order id

Definition at line 437 of file wallet.cpp.

References AssertLockHeld, strWalletFile, and CWalletDB::WriteOrderPosNext().

Referenced by movecmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::Inventory ( const uint256 hash)
inlinevirtual

Implements CWalletInterface.

Definition at line 353 of file wallet.h.

References LOCK.

bool CWallet::IsChange ( const CTxOut txout) const

Definition at line 685 of file wallet.cpp.

References ExtractDestination(), IsMine(), LOCK, and CTxOut::scriptPubKey.

Referenced by WalletModel::listCoins().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::IsFromMe ( const CTransaction tx) const
inline

Definition at line 305 of file wallet.h.

bool CWallet::IsLockedCoin ( uint256  hash,
unsigned int  n 
) const

Definition at line 1989 of file wallet.cpp.

References AssertLockHeld.

Referenced by WalletModel::isLockedCoin().

+ Here is the caller graph for this function:

bool CWallet::IsMine ( const CTxIn txin) const

Definition at line 653 of file wallet.cpp.

References COutPoint::hash, IsMine(), LOCK, COutPoint::n, CTxIn::prevout, and CTransaction::vout.

Referenced by TransactionRecord::decomposeTransaction(), CWalletTx::IsTrusted(), WalletModel::listCoins(), and TransactionDesc::toHTML().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::IsMine ( const CTxOut txout) const
inline

Definition at line 281 of file wallet.h.

References IsMine(), and CTxOut::scriptPubKey.

+ Here is the call graph for this function:

bool CWallet::IsMine ( const CTransaction tx) const
inline

Definition at line 298 of file wallet.h.

References IsMine(), and CTransaction::vout.

+ Here is the call graph for this function:

bool CWallet::IsSpent ( const uint256 hash,
unsigned int  n 
) const

Definition at line 319 of file wallet.cpp.

Referenced by CWalletTx::GetAvailableCredit(), WalletModel::isSpent(), and selectCoins().

+ Here is the caller graph for this function:

void CWallet::KeepKey ( int64_t  nIndex)

Definition at line 1705 of file wallet.cpp.

References CWalletDB::ErasePool(), LogPrintf, and strWalletFile.

+ Here is the call graph for this function:

void CWallet::ListLockedCoins ( std::vector< COutPoint > &  vOutpts)

Definition at line 1997 of file wallet.cpp.

References AssertLockHeld.

Referenced by WalletModel::listCoins(), WalletModel::listLockedCoins(), and listlockunspent().

+ Here is the caller graph for this function:

bool CWallet::LoadCryptedKey ( const CPubKey vchPubKey,
const std::vector< unsigned char > &  vchCryptedSecret 
)

Definition at line 117 of file wallet.cpp.

References CCryptoKeyStore::AddCryptedKey().

Referenced by ReadKeyValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::LoadCScript ( const CScript redeemScript)

Definition at line 131 of file wallet.cpp.

References CBasicKeyStore::AddCScript(), CScript::GetID(), LogPrintf, and MAX_SCRIPT_ELEMENT_SIZE.

Referenced by ReadKeyValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::LoadDestData ( const CTxDestination dest,
const std::string &  key,
const std::string &  value 
)

Adds a destination data tuple to the store, without saving it to disk.

Definition at line 2079 of file wallet.cpp.

Referenced by ReadKeyValue().

+ Here is the caller graph for this function:

bool CWallet::LoadKey ( const CKey key,
const CPubKey pubkey 
)
inline

Definition at line 203 of file wallet.h.

References CCryptoKeyStore::AddKeyPubKey().

Referenced by ReadKeyValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::LoadKeyMetadata ( const CPubKey pubkey,
const CKeyMetadata metadata 
)

Definition at line 107 of file wallet.cpp.

References AssertLockHeld, CPubKey::GetID(), and CKeyMetadata::nCreateTime.

Referenced by ReadKeyValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::LoadMinVersion ( int  nVersion)
inline

Definition at line 207 of file wallet.h.

References AssertLockHeld.

Referenced by CWalletDB::FindWalletTx(), and CWalletDB::LoadWallet().

+ Here is the caller graph for this function:

DBErrors CWallet::LoadWallet ( bool &  fFirstRunRet)

Definition at line 1496 of file wallet.cpp.

References DB_LOAD_OK, DB_NEED_REWRITE, CClientUIInterface::LoadWallet, CWalletDB::LoadWallet(), LOCK, CDB::Rewrite(), strWalletFile, and uiInterface.

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::LockCoin ( COutPoint output)

Definition at line 1971 of file wallet.cpp.

References AssertLockHeld.

Referenced by WalletModel::lockCoin(), and lockunspent().

+ Here is the caller graph for this function:

void CWallet::MarkDirty ( )

Definition at line 474 of file wallet.cpp.

References LOCK, and PAIRTYPE.

Referenced by importprivkey(), and importwallet().

+ Here is the caller graph for this function:

bool CWallet::NewKeyPool ( )

Definition at line 1608 of file wallet.cpp.

References CWalletDB::ErasePool(), GetArg(), LOCK, LogPrintf, strWalletFile, and CWalletDB::WritePool().

+ Here is the call graph for this function:

CWallet::TxItems CWallet::OrderedTxItems ( std::list< CAccountingEntry > &  acentries,
std::string  strAccount = "" 
)

Get the wallet's activity log.

Returns
multimap of ordered transactions and accounting entries
Warning
Returned pointers are only valid within the scope of passed acentries

Definition at line 449 of file wallet.cpp.

References AssertLockHeld, CWalletDB::ListAccountCreditDebit(), CWalletTx::nOrderPos, CAccountingEntry::nOrderPos, and strWalletFile.

Referenced by listtransactions(), and listtransactions_MP().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::ReacceptWalletTransactions ( )

Definition at line 887 of file wallet.cpp.

References CMerkleTx::AcceptToMemoryPool(), CTxMemPool::cs, cs_main, CMerkleTx::GetDepthInMainChain(), CTransaction::GetHash(), CTransaction::IsCoinBase(), LOCK, LOCK2, mempool, and PAIRTYPE.

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::ResendWalletTransactions ( )
virtual

Implements CWalletInterface.

Definition at line 931 of file wallet.cpp.

References GetRand(), GetTime(), LOCK, LogPrintf, nTimeBestReceived, CWalletTx::nTimeReceived, PAIRTYPE, and CWalletTx::RelayWalletTransaction().

+ Here is the call graph for this function:

void CWallet::ReserveKeyFromKeyPool ( int64_t &  nIndex,
CKeyPool keypool 
)

Definition at line 1663 of file wallet.cpp.

References CPubKey::GetID(), CPubKey::IsValid(), LOCK, LogPrintf, CWalletDB::ReadPool(), strWalletFile, and CKeyPool::vchPubKey.

+ Here is the call graph for this function:

void CWallet::ReturnKey ( int64_t  nIndex)

Definition at line 1716 of file wallet.cpp.

References LOCK, and LogPrintf.

int CWallet::ScanForWalletTransactions ( CBlockIndex pindexStart,
bool  fUpdate = false 
)

Definition at line 847 of file wallet.cpp.

References _(), chainActive, cs_main, CTransaction::GetHash(), GetTime(), Checkpoints::GuessVerificationProgress(), LOCK2, LogPrintf, CChain::Next(), CBlockIndex::nHeight, CBlockIndex::nTime, ReadBlockFromDisk(), ShowProgress(), CChain::Tip(), and CBlock::vtx.

Referenced by AppInit2(), importprivkey(), and importwallet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::SelectCoins ( int64_t  nTargetValue,
std::set< std::pair< const CWalletTx *, unsigned int > > &  setCoinsRet,
int64_t &  nValueRet,
const CCoinControl coinControl = NULL 
) const
private

Definition at line 1204 of file wallet.cpp.

References bSpendZeroConfChange, CCoinControl::HasSelected(), COutput::i, COutput::tx, and CTransaction::vout.

+ Here is the call graph for this function:

bool CWallet::SelectCoinsMinConf ( int64_t  nTargetValue,
int  nConfMine,
int  nConfTheirs,
std::vector< COutput vCoins,
std::set< std::pair< const CWalletTx *, unsigned int > > &  setCoinsRet,
int64_t &  nValueRet 
) const

Definition at line 1106 of file wallet.cpp.

References ApproximateBestSubset(), CENT, FormatMoney(), GetRandInt(), COutput::i, CWalletTx::IsFromMe(), LogPrint(), COutput::nDepth, COutput::tx, and CTransaction::vout.

+ Here is the call graph for this function:

string CWallet::SendMoney ( CScript  scriptPubKey,
int64_t  nValue,
CWalletTx wtxNew 
)

Definition at line 1450 of file wallet.cpp.

References _(), FormatMoney(), LogPrintf, and strprintf.

+ Here is the call graph for this function:

string CWallet::SendMoneyToDestination ( const CTxDestination address,
int64_t  nValue,
CWalletTx wtxNew 
)

Definition at line 1478 of file wallet.cpp.

References _(), nTransactionFee, and CScript::SetDestination().

Referenced by sendfrom(), and sendtoaddress().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::SetAddressBook ( const CTxDestination address,
const std::string &  strName,
const std::string &  purpose 
)

Definition at line 1548 of file wallet.cpp.

References CT_NEW, CT_UPDATED, IsMine(), LOCK, NotifyAddressBookChanged(), strWalletFile, CWalletDB::WriteName(), and CWalletDB::WritePurpose().

Referenced by addmultisigaddress(), AddressTableModel::addRow(), AppInit2(), PaymentServer::fetchPaymentACK(), GetAccountAddress(), getnewaddress(), importprivkey(), importwallet(), WalletModel::sendCoins(), setaccount(), and AddressTableModel::setData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::SetBestChain ( const CBlockLocator loc)
virtual

Implements CWalletInterface.

Definition at line 213 of file wallet.cpp.

References strWalletFile, and CWalletDB::WriteBestBlock().

Referenced by AppInit2(), and Shutdown().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::SetDefaultKey ( const CPubKey vchPubKey)

Definition at line 1593 of file wallet.cpp.

References strWalletFile.

Referenced by AppInit2().

+ Here is the caller graph for this function:

bool CWallet::SetMaxVersion ( int  nVersion)

Definition at line 246 of file wallet.cpp.

References LOCK.

Referenced by AppInit2().

+ Here is the caller graph for this function:

bool CWallet::SetMinVersion ( WalletFeature  nVersion,
CWalletDB pwalletdbIn = NULL,
bool  fExplicit = false 
)

Definition at line 219 of file wallet.cpp.

References FEATURE_LATEST, LOCK, strWalletFile, and CWalletDB::WriteMinVersion().

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::SetNull ( )
inline

Definition at line 155 of file wallet.h.

References FEATURE_BASE.

void CWallet::SyncMetaData ( std::pair< TxSpends::iterator, TxSpends::iterator >  )
private
void CWallet::SyncTransaction ( const uint256 hash,
const CTransaction tx,
const CBlock pblock 
)
virtual

Implements CWalletInterface.

Definition at line 624 of file wallet.cpp.

References cs_main, COutPoint::hash, LOCK2, CTxIn::prevout, and CTransaction::vin.

bool CWallet::TopUpKeyPool ( unsigned int  kpSize = 0)

Definition at line 1632 of file wallet.cpp.

References GetArg(), LOCK, LogPrintf, strWalletFile, and CWalletDB::WritePool().

Referenced by getnewaddress(), getrawchangeaddress(), keypoolrefill(), and walletpassphrase().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CWallet::Unlock ( const SecureString strWalletPassphrase)

Definition at line 147 of file wallet.cpp.

References CCrypter::Decrypt(), LOCK, CCrypter::SetKeyFromPassphrase(), and CCryptoKeyStore::Unlock().

Referenced by WalletModel::setWalletLocked(), and walletpassphrase().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CWallet::UnlockAllCoins ( )

Definition at line 1983 of file wallet.cpp.

References AssertLockHeld.

Referenced by lockunspent().

+ Here is the caller graph for this function:

void CWallet::UnlockCoin ( COutPoint output)

Definition at line 1977 of file wallet.cpp.

References AssertLockHeld.

Referenced by lockunspent(), and WalletModel::unlockCoin().

+ Here is the caller graph for this function:

void CWallet::UpdatedTransaction ( const uint256 hashTx)
virtual

Implements CWalletInterface.

Definition at line 1960 of file wallet.cpp.

References CT_UPDATED, LOCK, and NotifyTransactionChanged().

+ Here is the call graph for this function:

DBErrors CWallet::ZapWalletTx ( )

Definition at line 1524 of file wallet.cpp.

References DB_LOAD_OK, DB_NEED_REWRITE, LOCK, CDB::Rewrite(), strWalletFile, and CWalletDB::ZapWalletTx().

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

CCriticalSection CWallet::cs_wallet
mutable
bool CWallet::fFileBacked

Definition at line 134 of file wallet.h.

Referenced by BackupWallet().

std::map<CTxDestination, CAddressBookData> CWallet::mapAddressBook
std::map<CKeyID, CKeyMetadata> CWallet::mapKeyMetadata

Definition at line 138 of file wallet.h.

Referenced by importprivkey(), importwallet(), and ReadKeyValue().

MasterKeyMap CWallet::mapMasterKeys

Definition at line 141 of file wallet.h.

Referenced by ReadKeyValue().

std::map<uint256, int> CWallet::mapRequestCount

Definition at line 171 of file wallet.h.

TxSpends CWallet::mapTxSpends
private

Definition at line 120 of file wallet.h.

std::map<uint256, CWalletTx> CWallet::mapWallet
int64_t CWallet::nLastResend
private

Definition at line 114 of file wallet.h.

unsigned int CWallet::nMasterKeyMaxID

Definition at line 142 of file wallet.h.

Referenced by ReadKeyValue().

int64_t CWallet::nNextResend
private

Definition at line 113 of file wallet.h.

int64_t CWallet::nOrderPosNext

Definition at line 170 of file wallet.h.

Referenced by ReadKeyValue(), and CWalletDB::ReorderTransactions().

boost::signals2::signal<void (CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)> CWallet::NotifyAddressBookChanged

Address book entry changed.

Note
called with lock cs_wallet held.

Definition at line 389 of file wallet.h.

Referenced by WalletModel::subscribeToCoreSignals(), and WalletModel::unsubscribeFromCoreSignals().

boost::signals2::signal<void (CWallet *wallet, const uint256 &hashTx, ChangeType status)> CWallet::NotifyTransactionChanged

Wallet transaction added, removed or updated.

Note
called with lock cs_wallet held.

Definition at line 395 of file wallet.h.

Referenced by WalletModel::subscribeToCoreSignals(), and WalletModel::unsubscribeFromCoreSignals().

int64_t CWallet::nTimeFirstKey

Definition at line 179 of file wallet.h.

Referenced by importprivkey(), importwallet(), CWalletDB::LoadWallet(), and ReadKeyValue().

int CWallet::nWalletMaxVersion
private

Definition at line 111 of file wallet.h.

int CWallet::nWalletVersion
private

Definition at line 108 of file wallet.h.

CWalletDB* CWallet::pwalletdbEncryption
private

Definition at line 105 of file wallet.h.

std::set<int64_t> CWallet::setKeyPool

Definition at line 137 of file wallet.h.

Referenced by AppInit2(), and ReadKeyValue().

std::set<COutPoint> CWallet::setLockedCoins

Definition at line 177 of file wallet.h.

boost::signals2::signal<void (const std::string &title, int nProgress)> CWallet::ShowProgress
std::string CWallet::strWalletFile
CPubKey CWallet::vchDefaultKey

Definition at line 175 of file wallet.h.

Referenced by AppInit2(), CWalletDB::FindWalletTx(), CWalletDB::LoadWallet(), and ReadKeyValue().


The documentation for this class was generated from the following files: