Raven Core  3.0.0
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 142 of file walletdb.h.

Constructor & Destructor Documentation

◆ CWalletDB() [1/2]

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

Definition at line 166 of file walletdb.h.

◆ CWalletDB() [2/2]

CWalletDB::CWalletDB ( const CWalletDB )
delete

Member Function Documentation

◆ EraseDestData()

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

Erase destination data tuple from wallet database.

Definition at line 840 of file walletdb.cpp.

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

◆ EraseIC()

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

Definition at line 156 of file walletdb.h.

Here is the caller graph for this function:

◆ EraseName()

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

Definition at line 33 of file walletdb.cpp.

Here is the call graph for this function:

◆ ErasePool()

bool CWalletDB::ErasePool ( int64_t  nPool)

Definition at line 144 of file walletdb.cpp.

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

◆ ErasePurpose()

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

Definition at line 45 of file walletdb.cpp.

Here is the call graph for this function:

◆ EraseTx()

bool CWalletDB::EraseTx ( uint256  hash)

Definition at line 55 of file walletdb.cpp.

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

◆ EraseWatchOnly()

bool CWalletDB::EraseWatchOnly ( const CScript script)

Definition at line 109 of file walletdb.cpp.

Here is the call graph for this function:

◆ FindWalletTx()

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

Definition at line 639 of file walletdb.cpp.

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

◆ GetAccountCreditDebit()

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

Definition at line 170 of file walletdb.cpp.

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

◆ IsKeyType()

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

Definition at line 526 of file walletdb.cpp.

Here is the caller graph for this function:

◆ ListAccountCreditDebit()

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

Definition at line 182 of file walletdb.cpp.

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

◆ LoadWallet()

DBErrors CWalletDB::LoadWallet ( CWallet pwallet)

Definition at line 532 of file walletdb.cpp.

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

◆ operator=()

CWalletDB& CWalletDB::operator= ( const CWalletDB )
delete

◆ ReadAccount()

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

Definition at line 154 of file walletdb.cpp.

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

◆ ReadBestBlock()

bool CWalletDB::ReadBestBlock ( CBlockLocator locator)

Definition at line 123 of file walletdb.cpp.

Here is the call graph for this function:

◆ ReadPool()

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

Definition at line 134 of file walletdb.cpp.

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

◆ ReadVersion()

bool CWalletDB::ReadVersion ( int &  nVersion)

Read wallet version.

Definition at line 866 of file walletdb.cpp.

Here is the call graph for this function:

◆ Recover() [1/2]

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 790 of file walletdb.cpp.

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

◆ Recover() [2/2]

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

Definition at line 795 of file walletdb.cpp.

Here is the call graph for this function:

◆ RecoverKeysOnlyFilter()

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

Definition at line 802 of file walletdb.cpp.

Here is the call graph for this function:

◆ TxnAbort()

bool CWalletDB::TxnAbort ( )

Abort current transaction.

Definition at line 861 of file walletdb.cpp.

Here is the call graph for this function:

◆ TxnBegin()

bool CWalletDB::TxnBegin ( )

Begin a new transaction.

Definition at line 851 of file walletdb.cpp.

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

◆ TxnCommit()

bool CWalletDB::TxnCommit ( )

Commit current transaction.

Definition at line 856 of file walletdb.cpp.

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

◆ VerifyDatabaseFile()

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

Definition at line 830 of file walletdb.cpp.

Here is the call graph for this function:

◆ VerifyEnvironment()

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

Definition at line 825 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteAccount()

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

Definition at line 160 of file walletdb.cpp.

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

◆ WriteAccountingEntry()

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 165 of file walletdb.cpp.

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

◆ WriteBestBlock()

bool CWalletDB::WriteBestBlock ( const CBlockLocator locator)

Definition at line 117 of file walletdb.cpp.

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

◆ WriteCryptedKey()

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

Definition at line 75 of file walletdb.cpp.

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

◆ WriteCScript()

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

Definition at line 96 of file walletdb.cpp.

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

◆ WriteDestData()

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 835 of file walletdb.cpp.

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

◆ WriteHDChain()

bool CWalletDB::WriteHDChain ( const CHDChain chain)

write the hdchain model (external chain child index counter)

Definition at line 846 of file walletdb.cpp.

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

◆ WriteIC()

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

Definition at line 146 of file walletdb.h.

Here is the caller graph for this function:

◆ WriteKey()

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

Definition at line 60 of file walletdb.cpp.

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

◆ WriteMasterKey()

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

Definition at line 91 of file walletdb.cpp.

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

◆ WriteMinVersion()

bool CWalletDB::WriteMinVersion ( int  nVersion)

Definition at line 149 of file walletdb.cpp.

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

◆ WriteName()

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

Definition at line 28 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteOrderPosNext()

bool CWalletDB::WriteOrderPosNext ( int64_t  nOrderPosNext)

Definition at line 129 of file walletdb.cpp.

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

◆ WritePool()

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

Definition at line 139 of file walletdb.cpp.

Here is the call graph for this function:

◆ WritePurpose()

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

Definition at line 40 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteTx()

bool CWalletDB::WriteTx ( const CWalletTx wtx)

Definition at line 50 of file walletdb.cpp.

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

◆ WriteVersion()

bool CWalletDB::WriteVersion ( int  nVersion)

Write wallet version.

Definition at line 871 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteWatchOnly()

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

Definition at line 101 of file walletdb.cpp.

Here is the call graph for this function:

◆ ZapSelectTx()

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

Definition at line 702 of file walletdb.cpp.

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

◆ ZapWalletTx()

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

Definition at line 740 of file walletdb.cpp.

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

Member Data Documentation

◆ batch

CDB CWalletDB::batch
private

Definition at line 248 of file walletdb.h.

◆ m_dbw

CWalletDBWrapper& CWalletDB::m_dbw
private

Definition at line 249 of file walletdb.h.


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