![]() |
Anoncoin
0.9.4
P2P Digital Currency
|
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>
Public Types | |
typedef std::map< unsigned int, CMasterKey > | MasterKeyMap |
typedef std::pair< CWalletTx *, CAccountingEntry * > | TxPair |
typedef std::multimap< int64_t, TxPair > | TxItems |
Public Member Functions | |
CWallet () | |
CWallet (std::string strWalletFileIn) | |
void | SetNull () |
const CWalletTx * | GetWalletTx (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 | AddWatchOnly (const CScript &dest) |
bool | RemoveWatchOnly (const CScript &dest) |
bool | LoadWatchOnly (const CScript &dest) |
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 |
int64_t | GetWatchOnlyBalance () const |
int64_t | GetUnconfirmedWatchOnlyBalance () const |
int64_t | GetImmatureWatchOnlyBalance () 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< CTxDestination > | GetAccountAddresses (std::string strAccount) const |
isminetype | IsMine (const CTxIn &txin) const |
int64_t | GetDebit (const CTxIn &txin, const isminefilter &filter) const |
isminetype | IsMine (const CTxOut &txout) const |
int64_t | GetCredit (const CTxOut &txout, const isminefilter &filter) 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 isminefilter &filter) const |
int64_t | GetCredit (const CTransaction &tx, const isminefilter &filter) 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< uint256 > | GetConflicts (const uint256 &txid) const |
![]() | |
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 |
![]() | |
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 |
virtual bool | HaveWatchOnly (const CScript &dest) const |
virtual bool | HaveWatchOnly () const |
![]() | |
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, CKeyMetadata > | mapKeyMetadata |
MasterKeyMap | mapMasterKeys |
unsigned int | nMasterKeyMaxID |
std::map< uint256, CWalletTx > | mapWallet |
int64_t | nOrderPosNext |
std::map< uint256, int > | mapRequestCount |
std::map< CTxDestination, CAddressBookData > | mapAddressBook |
CPubKey | vchDefaultKey |
std::set< COutPoint > | setLockedCoins |
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... | |
boost::signals2::signal< void(bool fHaveWatchOnly)> | NotifyWatchonlyChanged |
Watch-only address added. More... | |
![]() | |
boost::signals2::signal< void(CCryptoKeyStore *wallet)> | NotifyStatusChanged |
Private Types | |
typedef std::multimap< COutPoint, uint256 > | TxSpends |
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 | |
CWalletDB * | pwalletdbEncryption |
int | nWalletVersion |
int | nWalletMaxVersion |
int64_t | nNextResend |
int64_t | nLastResend |
TxSpends | mapTxSpends |
Additional Inherited Members | |
![]() | |
bool | SetCrypted () |
bool | EncryptKeys (CKeyingMaterial &vMasterKeyIn) |
bool | Unlock (const CKeyingMaterial &vMasterKeyIn) |
![]() | |
friend | void::RegisterWallet (CWalletInterface *) |
friend | void::UnregisterWallet (CWalletInterface *) |
friend | void::UnregisterAllWallets () |
![]() | |
KeyMap | mapKeys |
ScriptMap | mapScripts |
WatchOnlySet | setWatchOnly |
![]() | |
CCriticalSection | cs_KeyStore |
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.
typedef std::map<unsigned int, CMasterKey> CWallet::MasterKeyMap |
typedef std::multimap<int64_t, TxPair > CWallet::TxItems |
typedef std::pair<CWalletTx*, CAccountingEntry*> CWallet::TxPair |
|
private |
|
virtual |
Reimplemented from CCryptoKeyStore.
Definition at line 94 of file wallet.cpp.
|
virtual |
Reimplemented from CBasicKeyStore.
Definition at line 130 of file wallet.cpp.
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 2149 of file wallet.cpp.
Reimplemented from CCryptoKeyStore.
Definition at line 72 of file wallet.cpp.
int64_t CWallet::AddReserveKey | ( | const CKeyPool & | keypool | ) |
Definition at line 373 of file wallet.cpp.
|
private |
Definition at line 383 of file wallet.cpp.
bool CWallet::AddToWallet | ( | const CWalletTx & | wtxIn, |
bool | fFromLoadWallet = false |
||
) |
Definition at line 521 of file wallet.cpp.
bool CWallet::AddToWalletIfInvolvingMe | ( | const uint256 & | hash, |
const CTransaction & | tx, | ||
const CBlock * | pblock, | ||
bool | fUpdate | ||
) |
|
virtual |
Reimplemented from CBasicKeyStore.
Definition at line 155 of file wallet.cpp.
void CWallet::AvailableCoins | ( | std::vector< COutput > & | vCoins, |
bool | fOnlyConfirmed = true , |
||
const CCoinControl * | coinControl = NULL |
||
) | const |
Definition at line 1110 of file wallet.cpp.
|
inline |
bool CWallet::ChangeWalletPassphrase | ( | const SecureString & | strOldWalletPassphrase, |
const SecureString & | strNewWalletPassphrase | ||
) |
Definition at line 205 of file wallet.cpp.
bool CWallet::CommitTransaction | ( | CWalletTx & | wtxNew, |
CReserveKey & | reservekey | ||
) |
Definition at line 1491 of file wallet.cpp.
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 |
||
) |
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 1482 of file wallet.cpp.
bool CWallet::DelAddressBook | ( | const CTxDestination & | address | ) |
Definition at line 1658 of file wallet.cpp.
bool CWallet::EncryptWallet | ( | const SecureString & | strWalletPassphrase | ) |
Definition at line 394 of file wallet.cpp.
bool CWallet::EraseDestData | ( | const CTxDestination & | dest, |
const std::string & | key | ||
) |
Erases a destination data tuple in the store and on disk.
Definition at line 2160 of file wallet.cpp.
|
virtual |
Implements CWalletInterface.
Definition at line 678 of file wallet.cpp.
CPubKey CWallet::GenerateNewKey | ( | ) |
set< CTxDestination > CWallet::GetAccountAddresses | ( | std::string | strAccount | ) | const |
std::map< CTxDestination, int64_t > CWallet::GetAddressBalances | ( | ) |
Definition at line 1846 of file wallet.cpp.
set< set< CTxDestination > > CWallet::GetAddressGroupings | ( | ) |
Definition at line 1886 of file wallet.cpp.
void CWallet::GetAllReserveKeys | ( | std::set< CKeyID > & | setAddress | ) | const |
Definition at line 2030 of file wallet.cpp.
int64_t CWallet::GetBalance | ( | ) | const |
Definition at line 1019 of file wallet.cpp.
|
inline |
|
inline |
Definition at line 296 of file wallet.cpp.
|
inline |
|
inline |
int64_t CWallet::GetDebit | ( | const CTxIn & | txin, |
const isminefilter & | filter | ||
) | const |
Definition at line 706 of file wallet.cpp.
|
inline |
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 2175 of file wallet.cpp.
int64_t CWallet::GetImmatureBalance | ( | ) | const |
Definition at line 1050 of file wallet.cpp.
int64_t CWallet::GetImmatureWatchOnlyBalance | ( | ) | const |
Definition at line 1095 of file wallet.cpp.
void CWallet::GetKeyBirthTimes | ( | std::map< CKeyID, int64_t > & | mapKeyBirth | ) | const |
Definition at line 2097 of file wallet.cpp.
bool CWallet::GetKeyFromPool | ( | CPubKey & | key | ) |
|
inline |
int64_t CWallet::GetOldestKeyPoolTime | ( | ) |
Definition at line 1835 of file wallet.cpp.
int64_t CWallet::GetUnconfirmedBalance | ( | ) | const |
Definition at line 1035 of file wallet.cpp.
int64_t CWallet::GetUnconfirmedWatchOnlyBalance | ( | ) | const |
Definition at line 1080 of file wallet.cpp.
|
inline |
int64_t CWallet::GetWatchOnlyBalance | ( | ) | const |
Definition at line 1064 of file wallet.cpp.
int64_t CWallet::IncOrderPosNext | ( | CWalletDB * | pwalletdb = NULL | ) |
Increment the next transaction order id.
Definition at line 475 of file wallet.cpp.
|
inlinevirtual |
Implements CWalletInterface.
bool CWallet::IsChange | ( | const CTxOut & | txout | ) | const |
Definition at line 722 of file wallet.cpp.
|
inline |
bool CWallet::IsLockedCoin | ( | uint256 | hash, |
unsigned int | n | ||
) | const |
isminetype CWallet::IsMine | ( | const CTxIn & | txin | ) | const |
Definition at line 691 of file wallet.cpp.
|
inline |
|
inline |
bool CWallet::IsSpent | ( | const uint256 & | hash, |
unsigned int | n | ||
) | const |
void CWallet::KeepKey | ( | int64_t | nIndex | ) |
void CWallet::ListLockedCoins | ( | std::vector< COutPoint > & | vOutpts | ) |
bool CWallet::LoadCryptedKey | ( | const CPubKey & | vchPubKey, |
const std::vector< unsigned char > & | vchCryptedSecret | ||
) |
Definition at line 125 of file wallet.cpp.
bool CWallet::LoadCScript | ( | const CScript & | redeemScript | ) |
Definition at line 139 of file wallet.cpp.
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 2169 of file wallet.cpp.
bool CWallet::LoadKeyMetadata | ( | const CPubKey & | pubkey, |
const CKeyMetadata & | metadata | ||
) |
Definition at line 115 of file wallet.cpp.
|
inline |
DBErrors CWallet::LoadWallet | ( | bool & | fFirstRunRet | ) |
Definition at line 1586 of file wallet.cpp.
bool CWallet::LoadWatchOnly | ( | const CScript & | dest | ) |
Definition at line 180 of file wallet.cpp.
void CWallet::LockCoin | ( | COutPoint & | output | ) |
void CWallet::MarkDirty | ( | ) |
bool CWallet::NewKeyPool | ( | ) |
CWallet::TxItems CWallet::OrderedTxItems | ( | std::list< CAccountingEntry > & | acentries, |
std::string | strAccount = "" |
||
) |
Get the wallet's activity log.
Definition at line 487 of file wallet.cpp.
void CWallet::ReacceptWalletTransactions | ( | ) |
Definition at line 926 of file wallet.cpp.
|
virtual |
Reimplemented from CBasicKeyStore.
Definition at line 166 of file wallet.cpp.
|
virtual |
Implements CWalletInterface.
Definition at line 970 of file wallet.cpp.
void CWallet::ReserveKeyFromKeyPool | ( | int64_t & | nIndex, |
CKeyPool & | keypool | ||
) |
void CWallet::ReturnKey | ( | int64_t | nIndex | ) |
Definition at line 1806 of file wallet.cpp.
int CWallet::ScanForWalletTransactions | ( | CBlockIndex * | pindexStart, |
bool | fUpdate = false |
||
) |
Definition at line 886 of file wallet.cpp.
|
private |
string CWallet::SendMoneyToDestination | ( | const CTxDestination & | address, |
int64_t | nValue, | ||
CWalletTx & | wtxNew | ||
) |
Definition at line 1568 of file wallet.cpp.
bool CWallet::SetAddressBook | ( | const CTxDestination & | address, |
const std::string & | strName, | ||
const std::string & | purpose | ||
) |
Definition at line 1638 of file wallet.cpp.
|
virtual |
Implements CWalletInterface.
Definition at line 251 of file wallet.cpp.
bool CWallet::SetDefaultKey | ( | const CPubKey & | vchPubKey | ) |
bool CWallet::SetMaxVersion | ( | int | nVersion | ) |
bool CWallet::SetMinVersion | ( | enum WalletFeature | nVersion, |
CWalletDB * | pwalletdbIn = NULL , |
||
bool | fExplicit = false |
||
) |
Definition at line 257 of file wallet.cpp.
|
private |
Definition at line 319 of file wallet.cpp.
|
virtual |
Implements CWalletInterface.
Definition at line 662 of file wallet.cpp.
bool CWallet::TopUpKeyPool | ( | unsigned int | kpSize = 0 | ) |
Definition at line 1722 of file wallet.cpp.
bool CWallet::Unlock | ( | const SecureString & | strWalletPassphrase | ) |
Definition at line 185 of file wallet.cpp.
void CWallet::UnlockAllCoins | ( | ) |
void CWallet::UnlockCoin | ( | COutPoint & | output | ) |
|
virtual |
Implements CWalletInterface.
Definition at line 2050 of file wallet.cpp.
DBErrors CWallet::ZapWalletTx | ( | ) |
Definition at line 1614 of file wallet.cpp.
|
mutable |
std::map<CTxDestination, CAddressBookData> CWallet::mapAddressBook |
std::map<CKeyID, CKeyMetadata> CWallet::mapKeyMetadata |
MasterKeyMap CWallet::mapMasterKeys |
boost::signals2::signal<void (CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)> CWallet::NotifyAddressBookChanged |
boost::signals2::signal<void (CWallet *wallet, const uint256 &hashTx, ChangeType status)> CWallet::NotifyTransactionChanged |
boost::signals2::signal<void (bool fHaveWatchOnly)> CWallet::NotifyWatchonlyChanged |
boost::signals2::signal<void (const std::string &title, int nProgress)> CWallet::ShowProgress |