Raven Core  3.0.0
P2P Digital Currency
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CWallet Class Referencefinal

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:
[legend]
Collaboration diagram for CWallet:
[legend]

Public Types

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

Public Member Functions

CWalletDBWrapperGetDBHandle ()
 Get database handle used by this wallet. More...
 
std::string GetName () const
 Get a name for this wallet for logging/debugging purposes. More...
 
void LoadKeyPool (int64_t nIndex, const CKeyPool &keypool)
 
 CWallet ()
 
 CWallet (std::unique_ptr< CWalletDBWrapper > dbw_in)
 
 ~CWallet ()
 
void SetNull ()
 
const CWalletTxGetWalletTx (const uint256 &hash) const
 
bool CanSupportFeature (enum WalletFeature wf) const
 check whether we are allowed to upgrade (or already support) to the named feature More...
 
void AvailableCoinsAll (std::vector< COutput > &vCoins, std::map< std::string, std::vector< COutput > > &mapAssetCoins, bool fGetRVN=true, bool fOnlyAssets=false, bool fOnlySafe=true, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t &nMaximumCount=0, const int &nMinDepth=0, const int &nMaxDepth=9999999) const
 populate vCoins with vector of available COutputs, and populates vAssetCoins in fWithAssets is set to true. More...
 
void AvailableAssets (std::map< std::string, std::vector< COutput > > &mapAssetCoins, bool fOnlySafe=true, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t &nMaximumCount=0, const int &nMinDepth=0, const int &nMaxDepth=9999999) const
 Helper function that calls AvailableCoinsAll, used for transfering assets. More...
 
void AvailableCoinsWithAssets (std::vector< COutput > &vCoins, std::map< std::string, std::vector< COutput > > &mapAssetCoins, bool fOnlySafe=true, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t &nMaximumCount=0, const int &nMinDepth=0, const int &nMaxDepth=9999999) const
 Helper function that calls AvailableCoinsAll, used to receive all coins, Assets and RVN. More...
 
void AvailableCoins (std::vector< COutput > &vCoins, bool fOnlySafe=true, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t &nMaximumCount=0, const int &nMinDepth=0, const int &nMaxDepth=9999999) const
 populate vCoins with vector of available COutputs. More...
 
std::map< CTxDestination, std::vector< COutput > > ListCoins () const
 Return list of available coins and locked coins grouped by non-change output address. More...
 
std::map< CTxDestination, std::vector< COutput > > ListAssets () const
 Return list of available assets and locked assets grouped by non-change output address. More...
 
const CTxOutFindNonChangeParentOutput (const CTransaction &tx, int output) const
 Find non-change parent output. More...
 
bool SelectCoinsMinConf (const CAmount &nTargetValue, int nConfMine, int nConfTheirs, uint64_t nMaxAncestors, std::vector< COutput > vCoins, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet) const
 Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is stochastic for some inputs and upon completion the coin set and corresponding actual target value is assembled. More...
 
bool SelectAssetsMinConf (const CAmount &nTargetValue, const int nConfMine, const int nConfTheirs, const uint64_t nMaxAncestors, const std::string &strAssetName, std::vector< COutput > vCoins, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet) const
 
bool IsSpent (const uint256 &hash, unsigned int n) const
 Outpoint is spent if any non-conflicted transaction spends it: More...
 
bool IsLockedCoin (uint256 hash, unsigned int n) const
 
void LockCoin (const COutPoint &output)
 
void UnlockCoin (const COutPoint &output)
 
void UnlockAllCoins ()
 
void ListLockedCoins (std::vector< COutPoint > &vOutpts) const
 
void AbortRescan ()
 
bool IsAbortingRescan ()
 
bool IsScanning ()
 
CPubKey GenerateNewKey (CWalletDB &walletdb, bool internal=false)
 keystore implementation Generate a new key More...
 
bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey) override
 Adds a key to the store, and saves it to disk. More...
 
bool AddKeyPubKeyWithDB (CWalletDB &walletdb, const CKey &key, const CPubKey &pubkey)
 
bool LoadKey (const CKey &key, const CPubKey &pubkey)
 Adds a key to the store, without saving it to disk (used by LoadWallet) More...
 
bool LoadKeyMetadata (const CTxDestination &pubKey, const CKeyMetadata &metadata)
 Load metadata (used by LoadWallet) More...
 
bool LoadMinVersion (int nVersion)
 
void UpdateTimeFirstKey (int64_t nCreateTime)
 Update wallet first key creation time. More...
 
bool AddCryptedKey (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret) override
 Adds an encrypted key to the store, and saves it to disk. More...
 
bool LoadCryptedKey (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
 Adds an encrypted key to the store, without saving it to disk (used by LoadWallet) More...
 
bool AddCScript (const CScript &redeemScript) override
 Support for BIP 0013 : see https://github.com/raven/bips/blob/master/bip-0013.mediawiki. More...
 
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...
 
std::vector< std::string > GetDestValues (const std::string &prefix) const
 Get all destination values matching a prefix. More...
 
bool AddWatchOnly (const CScript &dest, int64_t nCreateTime)
 Adds a watch-only address to the store, and saves it to disk. More...
 
bool RemoveWatchOnly (const CScript &dest) override
 
bool LoadWatchOnly (const CScript &dest)
 Adds a watch-only address to the store, without saving it to disk (used by LoadWallet) More...
 
bool Unlock (const SecureString &strWalletPassphrase)
 
bool ChangeWalletPassphrase (const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
 
bool EncryptWallet (const SecureString &strWalletPassphrase)
 
void GetKeyBirthTimes (std::map< CTxDestination, int64_t > &mapKeyBirth) const
 
unsigned int ComputeTimeSmart (const CWalletTx &wtx) const
 Compute smart timestamp for a transaction being added to the wallet. More...
 
int64_t IncOrderPosNext (CWalletDB *pwalletdb=nullptr)
 Increment the next transaction order id. More...
 
DBErrors ReorderTransactions ()
 
bool AccountMove (std::string strFrom, std::string strTo, CAmount nAmount, std::string strComment="")
 
bool GetAccountPubkey (CPubKey &pubKey, std::string strAccount, bool bForceNew=false)
 
void MarkDirty ()
 
bool AddToWallet (const CWalletTx &wtxIn, bool fFlushOnClose=true)
 
bool LoadToWallet (const CWalletTx &wtxIn)
 
void TransactionAddedToMempool (const CTransactionRef &tx) override
 Notifies listeners of a transaction having been added to mempool. More...
 
void BlockConnected (const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindex, const std::vector< CTransactionRef > &vtxConflicted) override
 Notifies listeners of a block being connected. More...
 
void BlockDisconnected (const std::shared_ptr< const CBlock > &pblock) override
 Notifies listeners of a block being disconnected. More...
 
bool AddToWalletIfInvolvingMe (const CTransactionRef &tx, const CBlockIndex *pIndex, int posInBlock, bool fUpdate)
 Add a transaction to the wallet, or update it. More...
 
int64_t RescanFromTime (int64_t startTime, bool update)
 Scan active chain for relevant transactions after importing keys. More...
 
CBlockIndexScanForWalletTransactions (CBlockIndex *pindexStart, CBlockIndex *pindexStop, bool fUpdate=false)
 Scan the block chain (starting in pindexStart) for transactions from or to us. More...
 
void ReacceptWalletTransactions ()
 
void ResendWalletTransactions (int64_t nBestBlockTime, CConnman *connman) override
 Tells listeners to broadcast their data. More...
 
std::vector< uint256ResendWalletTransactionsBefore (int64_t nTime, CConnman *connman)
 
CAmount GetBalance () const
 
CAmount GetUnconfirmedBalance () const
 
CAmount GetImmatureBalance () const
 
CAmount GetWatchOnlyBalance () const
 
CAmount GetUnconfirmedWatchOnlyBalance () const
 
CAmount GetImmatureWatchOnlyBalance () const
 
CAmount GetLegacyBalance (const isminefilter &filter, int minDepth, const std::string *account) const
 
CAmount GetAvailableBalance (const CCoinControl *coinControl=nullptr) const
 
bool FundTransaction (CMutableTransaction &tx, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, bool lockUnspents, const std::set< int > &setSubtractFeeFromOutputs, CCoinControl)
 Insert additional inputs into the transaction by calling CreateTransaction();. More...
 
bool SignTransaction (CMutableTransaction &tx)
 RVN END. More...
 
bool CreateTransactionWithAssets (const std::vector< CRecipient > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl &coin_control, const std::vector< CNewAsset > assets, const CTxDestination destination, const AssetType &assetType, bool sign=true)
 RVN START. More...
 
bool CreateTransactionWithTransferAsset (const std::vector< CRecipient > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl &coin_control, bool sign=true)
 
bool CreateTransactionWithReissueAsset (const std::vector< CRecipient > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl &coin_control, const CReissueAsset &reissueAsset, const CTxDestination destination, bool sign=true)
 
bool CreateTransaction (const std::vector< CRecipient > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl &coin_control, bool sign=true)
 
bool CreateTransactionAll (const std::vector< CRecipient > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl &coin_control, bool fNewAsset, const CNewAsset &asset, const CTxDestination dest, bool fTransferAsset, bool fReissueAsset, const CReissueAsset &reissueAsset, const AssetType &assetType, bool sign=true)
 Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also create the change output, when needed. More...
 
bool CreateTransactionAll (const std::vector< CRecipient > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl &coin_control, bool fNewAsset, const std::vector< CNewAsset > assets, const CTxDestination destination, bool fTransferAsset, bool fReissueAsset, const CReissueAsset &reissueAsset, const AssetType &assetType, bool sign)
 
bool CreateNewChangeAddress (CReserveKey &reservekey, CKeyID &keyID, std::string &strFailReason)
 RVN START. More...
 
bool CommitTransaction (CWalletTx &wtxNew, CReserveKey &reservekey, CConnman *connman, CValidationState &state)
 RVN END. More...
 
void ListAccountCreditDebit (const std::string &strAccount, std::list< CAccountingEntry > &entries)
 
bool AddAccountingEntry (const CAccountingEntry &)
 
bool AddAccountingEntry (const CAccountingEntry &, CWalletDB *pwalletdb)
 
template<typename ContainerType >
bool DummySignTx (CMutableTransaction &txNew, const ContainerType &coins) const
 
bool NewKeyPool ()
 Mark old keypool keys as used, and generate all new keys. More...
 
size_t KeypoolCountExternalKeys ()
 
bool TopUpKeyPool (unsigned int kpSize=0)
 
void ReserveKeyFromKeyPool (int64_t &nIndex, CKeyPool &keypool, bool fRequestedInternal)
 
void KeepKey (int64_t nIndex)
 
void ReturnKey (int64_t nIndex, bool fInternal, const CPubKey &pubkey)
 
bool GetKeyFromPool (CPubKey &key, bool internal=false)
 
int64_t GetOldestKeyPoolTime ()
 
void MarkReserveKeysAsUsed (int64_t keypool_id)
 Marks all keys in the keypool up to and including reserve_key as used. More...
 
const std::map< CKeyID, int64_t > & GetAllReserveKeys () const
 
std::set< std::set< CTxDestination > > GetAddressGroupings ()
 
std::map< CTxDestination, CAmountGetAddressBalances ()
 
std::set< CTxDestinationGetAccountAddresses (const std::string &strAccount) const
 
isminetype IsMine (const CTxIn &txin) const
 
CAmount GetDebit (const CTxIn &txin, const isminefilter &filter) const
 Returns amount of debit if the input matches the filter, otherwise returns 0. More...
 
CAmount GetDebit (const CTxIn &txin, const isminefilter &filter, CAssetOutputEntry &assetData) const
 
isminetype IsMine (const CTxOut &txout) const
 
CAmount GetCredit (const CTxOut &txout, const isminefilter &filter) const
 
bool IsChange (const CTxOut &txout) const
 
CAmount GetChange (const CTxOut &txout) const
 
bool IsMine (const CTransaction &tx) const
 
bool IsFromMe (const CTransaction &tx) const
 should probably be renamed to IsRelevantToMe More...
 
CAmount GetDebit (const CTransaction &tx, const isminefilter &filter) const
 
bool IsAllFromMe (const CTransaction &tx, const isminefilter &filter) const
 Returns whether all of the inputs match the filter. More...
 
CAmount GetCredit (const CTransaction &tx, const isminefilter &filter) const
 
CAmount GetChange (const CTransaction &tx) const
 
void SetBestChain (const CBlockLocator &loc) override
 Notifies listeners of the new active block chain on-disk. More...
 
DBErrors LoadWallet (bool &fFirstRunRet)
 
DBErrors ZapWalletTx (std::vector< CWalletTx > &vWtx)
 
DBErrors ZapSelectTx (std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut)
 
bool SetAddressBook (const CTxDestination &address, const std::string &strName, const std::string &purpose)
 
bool DelAddressBook (const CTxDestination &address)
 
const std::string & GetAccountName (const CScript &scriptPubKey) const
 
void Inventory (const uint256 &hash) override
 Notifies listeners about an inventory item being seen on the network. More...
 
void GetScriptForMining (std::shared_ptr< CReserveScript > &script)
 
unsigned int GetKeyPoolSize ()
 
bool SetMinVersion (enum WalletFeature, CWalletDB *pwalletdbIn=nullptr, bool fExplicit=false)
 signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVersion if those are lower More...
 
bool SetMaxVersion (int nVersion)
 change which version we're allowed to upgrade to (note that this does not immediately imply upgrading to that format) More...
 
int GetVersion ()
 get the current wallet format (the oldest client version guaranteed to understand this wallet) More...
 
std::set< uint256GetConflicts (const uint256 &txid) const
 Get wallet transactions that conflict with given transaction (spend same outputs) More...
 
bool HasWalletSpend (const uint256 &txid) const
 Check if a given transaction has any of its outputs spent by another transaction in the wallet. More...
 
void Flush (bool shutdown=false)
 Flush wallet (bitdb flush) More...
 
bool GetBroadcastTransactions () const
 Inquire whether this wallet broadcasts transactions. More...
 
void SetBroadcastTransactions (bool broadcast)
 Set whether this wallet broadcasts transactions. More...
 
bool TransactionCanBeAbandoned (const uint256 &hashTx) const
 Return whether transaction can be abandoned. More...
 
bool AbandonTransaction (const uint256 &hashTx)
 
bool MarkReplaced (const uint256 &originalHash, const uint256 &newHash)
 Mark a transaction as replaced by another transaction (e.g., BIP 125). More...
 
void postInitProcess (CScheduler &scheduler)
 Wallet post-init setup Gives the wallet a chance to register repetitive tasks and complete post-init tasks. More...
 
bool BackupWallet (const std::string &strDest)
 
bool SetHDChain (const CHDChain &chain, bool memonly)
 
const CHDChainGetHDChain () const
 
bool IsHDEnabled () const
 
CPubKey GenerateNewSeed ()
 
CPubKey DeriveNewSeed (const CKey &key)
 
bool SetHDSeed (const CPubKey &key)
 
- Public Member Functions inherited from CCryptoKeyStore
 CCryptoKeyStore ()
 
bool IsCrypted () const
 
bool IsLocked () const
 
bool Lock ()
 
bool HaveKey (const CKeyID &address) const override
 Check whether a key corresponding to a given address is present in the store. More...
 
bool GetKey (const CKeyID &address, CKey &keyOut) const override
 
bool GetPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const override
 
std::set< CKeyIDGetKeys () const override
 
- Public Member Functions inherited from CBasicKeyStore
bool HaveCScript (const CScriptID &hash) const override
 
bool GetCScript (const CScriptID &hash, CScript &redeemScriptOut) const override
 
bool HaveWatchOnly (const CScript &dest) const override
 
bool HaveWatchOnly () const override
 
- Public Member Functions inherited from CKeyStore
virtual ~CKeyStore ()
 
virtual bool AddKey (const CKey &key)
 

Static Public Member Functions

static CWalletCreateWalletFromFile (const std::string walletFile)
 

Public Attributes

CCriticalSection cs_wallet
 
std::map< CTxDestination, CKeyMetadatamapKeyMetadata
 
MasterKeyMap mapMasterKeys
 
unsigned int nMasterKeyMaxID
 
std::map< uint256, CWalletTxmapWallet
 
std::list< CAccountingEntrylaccentries
 
TxItems wtxOrdered
 
int64_t nOrderPosNext
 
uint64_t nAccountingEntryNumber
 
std::map< uint256, int > mapRequestCount
 
std::map< CTxDestination, CAddressBookDatamapAddressBook
 
std::set< COutPointsetLockedCoins
 
int64_t nRelockTime
 Holds a timestamp at which point the wallet is scheduled (externally) to be relocked. Caller must arrange for actual relocking to occur via Lock(). More...
 
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...
 
- Public Attributes inherited from CCryptoKeyStore
boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
 Wallet status (encrypted, locked) changed. More...
 

Static Public Attributes

static CFeeRate minTxFee = CFeeRate(DEFAULT_TRANSACTION_MINFEE)
 Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) Override with -mintxfee. More...
 
static CFeeRate fallbackFee = CFeeRate(DEFAULT_FALLBACK_FEE)
 If fee estimation does not have enough data to provide estimates, use this fee instead. More...
 
static CFeeRate m_discard_rate = CFeeRate(DEFAULT_DISCARD_FEE)
 

Private Types

typedef std::multimap< COutPoint, uint256TxSpends
 Used to keep track of spent outpoints, and detect and report conflicts (double-spends or mutated transactions where the mutant gets mined). More...
 

Private Member Functions

bool SelectCoins (const std::vector< COutput > &vAvailableCoins, const CAmount &nTargetValue, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CCoinControl *coinControl=nullptr) const
 Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coinControl are selected; Never select unconfirmed coins if they are not ours. More...
 
bool SelectAssets (const std::map< std::string, std::vector< COutput > > &mapAvailableAssets, const std::map< std::string, CAmount > &mapAssetTargetValue, std::set< CInputCoin > &setCoinsRet, std::map< std::string, CAmount > &nValueRet) const
 
void AddToSpends (const COutPoint &outpoint, const uint256 &wtxid)
 
void AddToSpends (const uint256 &wtxid)
 
void MarkConflicted (const uint256 &hashBlock, const uint256 &hashTx)
 
void SyncMetaData (std::pair< TxSpends::iterator, TxSpends::iterator >)
 
void SyncTransaction (const CTransactionRef &tx, const CBlockIndex *pindex=nullptr, int posInBlock=0)
 
void DeriveNewChildKey (CWalletDB &walletdb, CKeyMetadata &metadata, CKey &secret, bool internal=false)
 
bool AddWatchOnly (const CScript &dest) override
 Private version of AddWatchOnly method which does not accept a timestamp, and which will reset the wallet's nTimeFirstKey value to 1 if the watch key did not previously have a timestamp associated with it. More...
 

Private Attributes

std::atomic< bool > fAbortRescan
 
std::atomic< bool > fScanningWallet
 
CWalletDBpwalletdbEncryption
 
int nWalletVersion
 the current wallet version: clients below this version are not able to load the wallet More...
 
int nWalletMaxVersion
 the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded More...
 
int64_t nNextResend
 
int64_t nLastResend
 
bool fBroadcastTransactions
 
TxSpends mapTxSpends
 
CHDChain hdChain
 
std::set< int64_t > setInternalKeyPool
 
std::set< int64_t > setExternalKeyPool
 
int64_t m_max_keypool_index
 
std::map< CKeyID, int64_t > m_pool_key_to_index
 
int64_t nTimeFirstKey
 
std::unique_ptr< CWalletDBWrapperdbw
 

Static Private Attributes

static std::atomic< bool > fFlushScheduled
 

Additional Inherited Members

- Protected Member Functions inherited from CCryptoKeyStore
bool SetCrypted ()
 
bool EncryptKeys (CKeyingMaterial &vMasterKeyIn)
 will encrypt previously unencrypted keys More...
 
bool Unlock (const CKeyingMaterial &vMasterKeyIn)
 
- Protected Member Functions inherited from CValidationInterface
virtual void UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
 Notifies listeners of updated block chain tip. More...
 
virtual void BlockChecked (const CBlock &, const CValidationState &)
 Notifies listeners of a block validation result. More...
 
virtual void NewPoWValidBlock (const CBlockIndex *pindex, const std::shared_ptr< const CBlock > &block)
 Notifies listeners that a block which builds directly on our current tip has been received and connected to the headers tree, though not validated yet. More...
 
virtual void BlockFound (const uint256 &hash)
 
virtual void NewAssetMessage (const CMessage &message)
 
friend void ::RegisterValidationInterface (CValidationInterface *)
 
friend void ::UnregisterValidationInterface (CValidationInterface *)
 
friend void ::UnregisterAllValidationInterfaces ()
 
- Protected Attributes inherited from CCryptoKeyStore
CryptedKeyMap mapCryptedKeys
 
- Protected Attributes inherited from CBasicKeyStore
KeyMap mapKeys
 
WatchKeyMap mapWatchKeys
 
ScriptMap mapScripts
 
WatchOnlySet setWatchOnly
 
- 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 673 of file wallet.h.

Member Typedef Documentation

◆ MasterKeyMap

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

Definition at line 778 of file wallet.h.

◆ TxItems

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

Definition at line 822 of file wallet.h.

◆ TxPair

Definition at line 821 of file wallet.h.

◆ TxSpends

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

Used to keep track of spent outpoints, and detect and report conflicts (double-spends or mutated transactions where the mutant gets mined).

Definition at line 706 of file wallet.h.

Constructor & Destructor Documentation

◆ CWallet() [1/2]

CWallet::CWallet ( )
inline

Definition at line 783 of file wallet.h.

◆ CWallet() [2/2]

CWallet::CWallet ( std::unique_ptr< CWalletDBWrapper dbw_in)
inlineexplicit

Definition at line 789 of file wallet.h.

◆ ~CWallet()

CWallet::~CWallet ( )
inline

Definition at line 794 of file wallet.h.

Member Function Documentation

◆ AbortRescan()

void CWallet::AbortRescan ( )
inline

Definition at line 907 of file wallet.h.

Here is the caller graph for this function:

◆ AddDestData()

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 4477 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BackupWallet()

bool CWallet::BackupWallet ( const std::string &  strDest)

Definition at line 4731 of file wallet.cpp.

Here is the caller graph for this function:

◆ CanSupportFeature()

bool CWallet::CanSupportFeature ( enum WalletFeature  wf) const
inline

check whether we are allowed to upgrade (or already support) to the named feature

Definition at line 836 of file wallet.h.

◆ ComputeTimeSmart()

unsigned int CWallet::ComputeTimeSmart ( const CWalletTx wtx) const

Compute smart timestamp for a transaction being added to the wallet.

Logic:

  • If sending a transaction, assign its timestamp to the current time.
  • If receiving a transaction outside a block, assign its timestamp to the current time.
  • If receiving a block with a future timestamp, assign all its (not already known) transactions' timestamps to the current time.
  • If receiving a block with a past timestamp, before the most recent known transaction (that we care about), assign all its (not already known) transactions' timestamps to the same timestamp as that most-recent-known transaction.
  • If receiving a block with a past timestamp, but after the most recent known transaction, assign all its (not already known) transactions' timestamps to the block time.

For more information see CWalletTx::nTimeSmart, https://raventalk.org/?topic=54527, or https://github.com/RavenProject/Ravencoin/pull/1393.

Definition at line 4433 of file wallet.cpp.

Here is the call graph for this function:

◆ CreateWalletFromFile()

CWallet * CWallet::CreateWalletFromFile ( const std::string  walletFile)
static

Definition at line 4529 of file wallet.cpp.

Here is the call graph for this function:

◆ DummySignTx()

template<typename ContainerType >
bool CWallet::DummySignTx ( CMutableTransaction txNew,
const ContainerType &  coins 
) const

Definition at line 1259 of file wallet.h.

Here is the call graph for this function:

◆ EraseDestData()

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

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

Definition at line 4486 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAllReserveKeys()

const std::map<CKeyID, int64_t>& CWallet::GetAllReserveKeys ( ) const
inline

Definition at line 1051 of file wallet.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBroadcastTransactions()

bool CWallet::GetBroadcastTransactions ( ) const
inline

Inquire whether this wallet broadcasts transactions.

Definition at line 1148 of file wallet.h.

Here is the caller graph for this function:

◆ GetDBHandle()

CWalletDBWrapper& CWallet::GetDBHandle ( )
inline

Get database handle used by this wallet.

Ideally this function would not be necessary.

Definition at line 756 of file wallet.h.

◆ GetDestData()

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 4499 of file wallet.cpp.

◆ GetDestValues()

std::vector< std::string > CWallet::GetDestValues ( const std::string &  prefix) const

Get all destination values matching a prefix.

Definition at line 4515 of file wallet.cpp.

Here is the caller graph for this function:

◆ GetHDChain()

const CHDChain& CWallet::GetHDChain ( ) const
inline

Definition at line 1174 of file wallet.h.

◆ GetKeyBirthTimes()

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

Definition at line 4361 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetKeyPoolSize()

unsigned int CWallet::GetKeyPoolSize ( )
inline

Definition at line 1101 of file wallet.h.

Here is the caller graph for this function:

◆ GetName()

std::string CWallet::GetName ( ) const
inline

Get a name for this wallet for logging/debugging purposes.

Definition at line 763 of file wallet.h.

Here is the caller graph for this function:

◆ GetVersion()

int CWallet::GetVersion ( )
inline

get the current wallet format (the oldest client version guaranteed to understand this wallet)

Definition at line 1114 of file wallet.h.

◆ Inventory()

void CWallet::Inventory ( const uint256 hash)
inlineoverridevirtual

Notifies listeners about an inventory item being seen on the network.

Reimplemented from CValidationInterface.

Definition at line 1089 of file wallet.h.

◆ IsAbortingRescan()

bool CWallet::IsAbortingRescan ( )
inline

Definition at line 908 of file wallet.h.

Here is the caller graph for this function:

◆ IsScanning()

bool CWallet::IsScanning ( )
inline

Definition at line 909 of file wallet.h.

Here is the caller graph for this function:

◆ LoadDestData()

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 4493 of file wallet.cpp.

Here is the caller graph for this function:

◆ LoadKey()

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

Adds a key to the store, without saving it to disk (used by LoadWallet)

Definition at line 920 of file wallet.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadMinVersion()

bool CWallet::LoadMinVersion ( int  nVersion)
inline

Definition at line 924 of file wallet.h.

◆ postInitProcess()

void CWallet::postInitProcess ( CScheduler scheduler)

Wallet post-init setup Gives the wallet a chance to register repetitive tasks and complete post-init tasks.

Definition at line 4719 of file wallet.cpp.

Here is the call graph for this function:

◆ SetBroadcastTransactions()

void CWallet::SetBroadcastTransactions ( bool  broadcast)
inline

Set whether this wallet broadcasts transactions.

Definition at line 1150 of file wallet.h.

◆ SetNull()

void CWallet::SetNull ( )
inline

Definition at line 800 of file wallet.h.

Member Data Documentation

◆ cs_wallet

CCriticalSection CWallet::cs_wallet
mutable

Definition at line 751 of file wallet.h.

◆ dbw

std::unique_ptr<CWalletDBWrapper> CWallet::dbw
private

Definition at line 744 of file wallet.h.

◆ fAbortRescan

std::atomic<bool> CWallet::fAbortRescan
private

Definition at line 677 of file wallet.h.

◆ fallbackFee

CFeeRate CWallet::fallbackFee = CFeeRate(DEFAULT_FALLBACK_FEE)
static

If fee estimation does not have enough data to provide estimates, use this fee instead.

Has no effect if not using fee estimation Override with -fallbackfee

Definition at line 1036 of file wallet.h.

◆ fBroadcastTransactions

bool CWallet::fBroadcastTransactions
private

Definition at line 699 of file wallet.h.

◆ fFlushScheduled

std::atomic< bool > CWallet::fFlushScheduled
staticprivate

Definition at line 676 of file wallet.h.

◆ fScanningWallet

std::atomic<bool> CWallet::fScanningWallet
private

Definition at line 678 of file wallet.h.

◆ hdChain

CHDChain CWallet::hdChain
private

Definition at line 721 of file wallet.h.

◆ laccentries

std::list<CAccountingEntry> CWallet::laccentries

Definition at line 819 of file wallet.h.

◆ m_discard_rate

CFeeRate CWallet::m_discard_rate = CFeeRate(DEFAULT_DISCARD_FEE)
static

Definition at line 1037 of file wallet.h.

◆ m_max_keypool_index

int64_t CWallet::m_max_keypool_index
private

Definition at line 728 of file wallet.h.

◆ m_pool_key_to_index

std::map<CKeyID, int64_t> CWallet::m_pool_key_to_index
private

Definition at line 729 of file wallet.h.

◆ mapAddressBook

std::map<CTxDestination, CAddressBookData> CWallet::mapAddressBook

Definition at line 829 of file wallet.h.

◆ mapKeyMetadata

std::map<CTxDestination, CKeyMetadata> CWallet::mapKeyMetadata

Definition at line 776 of file wallet.h.

◆ mapMasterKeys

MasterKeyMap CWallet::mapMasterKeys

Definition at line 779 of file wallet.h.

◆ mapRequestCount

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

Definition at line 827 of file wallet.h.

◆ mapTxSpends

TxSpends CWallet::mapTxSpends
private

Definition at line 707 of file wallet.h.

◆ mapWallet

std::map<uint256, CWalletTx> CWallet::mapWallet

Definition at line 818 of file wallet.h.

◆ minTxFee

CFeeRate CWallet::minTxFee = CFeeRate(DEFAULT_TRANSACTION_MINFEE)
static

Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) Override with -mintxfee.

Definition at line 1035 of file wallet.h.

◆ nAccountingEntryNumber

uint64_t CWallet::nAccountingEntryNumber

Definition at line 826 of file wallet.h.

◆ nLastResend

int64_t CWallet::nLastResend
private

Definition at line 698 of file wallet.h.

◆ nMasterKeyMaxID

unsigned int CWallet::nMasterKeyMaxID

Definition at line 780 of file wallet.h.

◆ nNextResend

int64_t CWallet::nNextResend
private

Definition at line 697 of file wallet.h.

◆ nOrderPosNext

int64_t CWallet::nOrderPosNext

Definition at line 825 of file wallet.h.

◆ NotifyAddressBookChanged

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 1132 of file wallet.h.

◆ NotifyTransactionChanged

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 1139 of file wallet.h.

◆ NotifyWatchonlyChanged

boost::signals2::signal<void (bool fHaveWatchOnly)> CWallet::NotifyWatchonlyChanged

Watch-only address added.

Definition at line 1145 of file wallet.h.

◆ nRelockTime

int64_t CWallet::nRelockTime

Holds a timestamp at which point the wallet is scheduled (externally) to be relocked. Caller must arrange for actual relocking to occur via Lock().

Definition at line 952 of file wallet.h.

◆ nTimeFirstKey

int64_t CWallet::nTimeFirstKey
private

Definition at line 731 of file wallet.h.

◆ nWalletMaxVersion

int CWallet::nWalletMaxVersion
private

the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded

Definition at line 695 of file wallet.h.

◆ nWalletVersion

int CWallet::nWalletVersion
private

the current wallet version: clients below this version are not able to load the wallet

Definition at line 692 of file wallet.h.

◆ pwalletdbEncryption

CWalletDB* CWallet::pwalletdbEncryption
private

Definition at line 689 of file wallet.h.

◆ setExternalKeyPool

std::set<int64_t> CWallet::setExternalKeyPool
private

Definition at line 727 of file wallet.h.

◆ setInternalKeyPool

std::set<int64_t> CWallet::setInternalKeyPool
private

Definition at line 726 of file wallet.h.

◆ setLockedCoins

std::set<COutPoint> CWallet::setLockedCoins

Definition at line 831 of file wallet.h.

◆ ShowProgress

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

Show progress e.g.

for rescan

Definition at line 1142 of file wallet.h.

◆ wtxOrdered

TxItems CWallet::wtxOrdered

Definition at line 823 of file wallet.h.


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