Fabcoin Core  0.16.2
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)
 
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 WriteToken (const CTokenInfo &wtoken)
 
bool EraseToken (uint256 hash)
 
bool WriteTokenTx (const CTokenTx &wTokenTx)
 
bool EraseTokenTx (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 WriteDefaultKey (const CPubKey &vchPubKey)
 
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...
 
bool WriteContractData (const std::string &address, const std::string &key, const std::string &value)
 Write contract data key,value tuple to database. More...
 
bool EraseContractData (const std::string &address, const std::string &key)
 Erase contract 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)
 
 CWalletDB (const CWalletDB &)
 
void operator= (const CWalletDB &)
 

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 143 of file walletdb.h.

Constructor & Destructor Documentation

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

Definition at line 167 of file walletdb.h.

Here is the call graph for this function:

CWalletDB::CWalletDB ( const CWalletDB )
private

Member Function Documentation

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

Erase contract data tuple from wallet database.

Definition at line 931 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Erase destination data tuple from wallet database.

Definition at line 871 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 157 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 148 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::EraseToken ( uint256  hash)

Definition at line 912 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::EraseTokenTx ( uint256  hash)

Definition at line 922 of file walletdb.cpp.

Here is the call 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 670 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 174 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 557 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 186 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 563 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 158 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 138 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 897 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 821 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 826 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 833 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 892 of file walletdb.cpp.

Here is the call graph for this function:

bool CWalletDB::TxnBegin ( )

Begin a new transaction.

Definition at line 882 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 887 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 861 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 856 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 164 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 169 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::WriteContractData ( const std::string &  address,
const std::string &  key,
const std::string &  value 
)

Write contract data key,value tuple to database.

Definition at line 926 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::WriteDefaultKey ( const CPubKey vchPubKey)

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::WriteDestData ( const std::string &  address,
const std::string &  key,
const std::string &  value 
)

Write destination data key,value tuple to database.

Definition at line 866 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 877 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 147 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 153 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 143 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::WriteToken ( const CTokenInfo wtoken)

Definition at line 907 of file walletdb.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CWalletDB::WriteTokenTx ( const CTokenTx wTokenTx)

Definition at line 917 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 902 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 733 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 771 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 261 of file walletdb.h.

CWalletDBWrapper& CWalletDB::m_dbw
private

Definition at line 262 of file walletdb.h.


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