Bitcoin Core  0.15.99
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
CWalletDB Class Reference

Access to the wallet database. More...

#include <walletdb.h>

Collaboration diagram for CWalletDB:
[legend]

Public Member Functions

 CWalletDB (CWalletDBWrapper &dbw, const char *pszMode="r+", bool _fFlushOnClose=true)
 
 CWalletDB (const CWalletDB &)=delete
 
CWalletDBoperator= (const CWalletDB &)=delete
 
bool WriteName (const std::string &strAddress, const std::string &strName)
 
bool EraseName (const std::string &strAddress)
 
bool WritePurpose (const std::string &strAddress, const std::string &purpose)
 
bool ErasePurpose (const std::string &strAddress)
 
bool WriteTx (const CWalletTx &wtx)
 
bool EraseTx (uint256 hash)
 
bool WriteKey (const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, const CKeyMetadata &keyMeta)
 
bool WriteCryptedKey (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret, const CKeyMetadata &keyMeta)
 
bool WriteMasterKey (unsigned int nID, const CMasterKey &kMasterKey)
 
bool WriteCScript (const uint160 &hash, const CScript &redeemScript)
 
bool WriteWatchOnly (const CScript &script, const CKeyMetadata &keymeta)
 
bool EraseWatchOnly (const CScript &script)
 
bool WriteBestBlock (const CBlockLocator &locator)
 
bool ReadBestBlock (CBlockLocator &locator)
 
bool WriteOrderPosNext (int64_t nOrderPosNext)
 
bool ReadPool (int64_t nPool, CKeyPool &keypool)
 
bool WritePool (int64_t nPool, const CKeyPool &keypool)
 
bool ErasePool (int64_t nPool)
 
bool WriteMinVersion (int nVersion)
 
bool WriteAccountingEntry (const uint64_t nAccEntryNum, const CAccountingEntry &acentry)
 This writes directly to the database, and will not update the CWallet's cached accounting entries! Use wallet.AddAccountingEntry instead, to write and update its caches. More...
 
bool ReadAccount (const std::string &strAccount, CAccount &account)
 
bool WriteAccount (const std::string &strAccount, const CAccount &account)
 
bool WriteDestData (const std::string &address, const std::string &key, const std::string &value)
 Write destination data key,value tuple to database. More...
 
bool EraseDestData (const std::string &address, const std::string &key)
 Erase destination data tuple from wallet database. More...
 
CAmount GetAccountCreditDebit (const std::string &strAccount)
 
void ListAccountCreditDebit (const std::string &strAccount, std::list< CAccountingEntry > &acentries)
 
DBErrors LoadWallet (CWallet *pwallet)
 
DBErrors FindWalletTx (std::vector< uint256 > &vTxHash, std::vector< CWalletTx > &vWtx)
 
DBErrors ZapWalletTx (std::vector< CWalletTx > &vWtx)
 
DBErrors ZapSelectTx (std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut)
 
bool WriteHDChain (const CHDChain &chain)
 write the hdchain model (external chain child index counter) More...
 
bool TxnBegin ()
 Begin a new transaction. More...
 
bool TxnCommit ()
 Commit current transaction. More...
 
bool TxnAbort ()
 Abort current transaction. More...
 
bool ReadVersion (int &nVersion)
 Read wallet version. More...
 
bool WriteVersion (int nVersion)
 Write wallet version. More...
 

Static Public Member Functions

static bool Recover (const std::string &filename, void *callbackDataIn, bool(*recoverKVcallback)(void *callbackData, CDataStream ssKey, CDataStream ssValue), std::string &out_backup_filename)
 
static bool Recover (const std::string &filename, std::string &out_backup_filename)
 
static bool RecoverKeysOnlyFilter (void *callbackData, CDataStream ssKey, CDataStream ssValue)
 
static bool IsKeyType (const std::string &strType)
 
static bool VerifyEnvironment (const std::string &walletFile, const fs::path &dataDir, std::string &errorStr)
 
static bool VerifyDatabaseFile (const std::string &walletFile, const fs::path &dataDir, std::string &warningStr, std::string &errorStr)
 

Private Member Functions

template<typename K , typename T >
bool WriteIC (const K &key, const T &value, bool fOverwrite=true)
 
template<typename K >
bool EraseIC (const K &key)
 

Private Attributes

CDB batch
 
CWalletDBWrapperm_dbw
 

Detailed Description

Access to the wallet database.

This should really be named CWalletDBBatch, as it represents a single transaction at the database. It will be committed when the object goes out of scope. Optionally (on by default) it will flush to disk as well.

Definition at line 141 of file walletdb.h.

Constructor & Destructor Documentation

CWalletDB::CWalletDB ( CWalletDBWrapper dbw,
const char *  pszMode = "r+",
bool  _fFlushOnClose = true 
)
inlineexplicit

Definition at line 165 of file walletdb.h.

CWalletDB::CWalletDB ( const CWalletDB )
delete

Member Function Documentation

bool CWalletDB::EraseDestData ( const std::string &  address,
const std::string &  key 
)

Erase destination data tuple from wallet database.

Definition at line 832 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename K >
bool CWalletDB::EraseIC ( const K &  key)
inlineprivate

Definition at line 155 of file walletdb.h.

Here is the caller graph for this function:

bool CWalletDB::EraseName ( const std::string &  strAddress)

Definition at line 32 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::ErasePool ( int64_t  nPool)

Definition at line 143 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::ErasePurpose ( const std::string &  strAddress)

Definition at line 44 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::EraseTx ( uint256  hash)

Definition at line 54 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::EraseWatchOnly ( const CScript script)

Definition at line 108 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DBErrors CWalletDB::FindWalletTx ( std::vector< uint256 > &  vTxHash,
std::vector< CWalletTx > &  vWtx 
)

Definition at line 631 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CAmount CWalletDB::GetAccountCreditDebit ( const std::string &  strAccount)

Definition at line 169 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::IsKeyType ( const std::string &  strType)
static

Definition at line 519 of file walletdb.cpp.

Here is the caller graph for this function:

void CWalletDB::ListAccountCreditDebit ( const std::string &  strAccount,
std::list< CAccountingEntry > &  acentries 
)

Definition at line 181 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DBErrors CWalletDB::LoadWallet ( CWallet pwallet)

Definition at line 525 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CWalletDB& CWalletDB::operator= ( const CWalletDB )
delete
bool CWalletDB::ReadAccount ( const std::string &  strAccount,
CAccount account 
)

Definition at line 153 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::ReadBestBlock ( CBlockLocator locator)

Definition at line 122 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::ReadPool ( int64_t  nPool,
CKeyPool keypool 
)

Definition at line 133 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::ReadVersion ( int &  nVersion)

Read wallet version.

Definition at line 858 of file walletdb.cpp.

Here is the call graph for this function:

bool CWalletDB::Recover ( const std::string &  filename,
void *  callbackDataIn,
bool(*)(void *callbackData, CDataStream ssKey, CDataStream ssValue)  recoverKVcallback,
std::string &  out_backup_filename 
)
static

Definition at line 782 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::Recover ( const std::string &  filename,
std::string &  out_backup_filename 
)
static

Definition at line 787 of file walletdb.cpp.

Here is the call graph for this function:

bool CWalletDB::RecoverKeysOnlyFilter ( void *  callbackData,
CDataStream  ssKey,
CDataStream  ssValue 
)
static

Definition at line 794 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::TxnAbort ( )

Abort current transaction.

Definition at line 853 of file walletdb.cpp.

Here is the call graph for this function:

bool CWalletDB::TxnBegin ( )

Begin a new transaction.

Definition at line 843 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::TxnCommit ( )

Commit current transaction.

Definition at line 848 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::VerifyDatabaseFile ( const std::string &  walletFile,
const fs::path &  dataDir,
std::string &  warningStr,
std::string &  errorStr 
)
static

Definition at line 822 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::VerifyEnvironment ( const std::string &  walletFile,
const fs::path &  dataDir,
std::string &  errorStr 
)
static

Definition at line 817 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteAccount ( const std::string &  strAccount,
const CAccount account 
)

Definition at line 159 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteAccountingEntry ( const uint64_t  nAccEntryNum,
const CAccountingEntry acentry 
)

This writes directly to the database, and will not update the CWallet's cached accounting entries! Use wallet.AddAccountingEntry instead, to write and update its caches.

Definition at line 164 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteBestBlock ( const CBlockLocator locator)

Definition at line 116 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteCryptedKey ( const CPubKey vchPubKey,
const std::vector< unsigned char > &  vchCryptedSecret,
const CKeyMetadata keyMeta 
)

Definition at line 74 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteCScript ( const uint160 hash,
const CScript redeemScript 
)

Definition at line 95 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteDestData ( const std::string &  address,
const std::string &  key,
const std::string &  value 
)

Write destination data key,value tuple to database.

Definition at line 827 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteHDChain ( const CHDChain chain)

write the hdchain model (external chain child index counter)

Definition at line 838 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename K , typename T >
bool CWalletDB::WriteIC ( const K &  key,
const T &  value,
bool  fOverwrite = true 
)
inlineprivate

Definition at line 145 of file walletdb.h.

Here is the caller graph for this function:

bool CWalletDB::WriteKey ( const CPubKey vchPubKey,
const CPrivKey vchPrivKey,
const CKeyMetadata keyMeta 
)

Definition at line 59 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteMasterKey ( unsigned int  nID,
const CMasterKey kMasterKey 
)

Definition at line 90 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteMinVersion ( int  nVersion)

Definition at line 148 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteName ( const std::string &  strAddress,
const std::string &  strName 
)

Definition at line 27 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteOrderPosNext ( int64_t  nOrderPosNext)

Definition at line 128 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WritePool ( int64_t  nPool,
const CKeyPool keypool 
)

Definition at line 138 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WritePurpose ( const std::string &  strAddress,
const std::string &  purpose 
)

Definition at line 39 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteTx ( const CWalletTx wtx)

Definition at line 49 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteVersion ( int  nVersion)

Write wallet version.

Definition at line 863 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteWatchOnly ( const CScript script,
const CKeyMetadata keymeta 
)

Definition at line 100 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DBErrors CWalletDB::ZapSelectTx ( std::vector< uint256 > &  vHashIn,
std::vector< uint256 > &  vHashOut 
)

Definition at line 694 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DBErrors CWalletDB::ZapWalletTx ( std::vector< CWalletTx > &  vWtx)

Definition at line 732 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

CDB CWalletDB::batch
private

Definition at line 247 of file walletdb.h.

CWalletDBWrapper& CWalletDB::m_dbw
private

Definition at line 248 of file walletdb.h.


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