Bitcoin Core  0.20.99
P2P Digital Currency
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
walletdb.h File Reference
#include <amount.h>
#include <script/sign.h>
#include <wallet/bdb.h>
#include <wallet/db.h>
#include <wallet/walletutil.h>
#include <key.h>
#include <stdint.h>
#include <string>
#include <vector>
Include dependency graph for walletdb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CHDChain
 
class  CKeyMetadata
 
class  WalletBatch
 Access to the wallet database. More...
 

Namespaces

 DBKeys
 

Typedefs

using KeyFilterFn = std::function< bool(const std::string &)>
 Callback for filtering key types to deserialize in ReadKeyValue. More...
 

Enumerations

enum  DBErrors {
  DBErrors::LOAD_OK, DBErrors::CORRUPT, DBErrors::NONCRITICAL_ERROR, DBErrors::TOO_NEW,
  DBErrors::LOAD_FAIL, DBErrors::NEED_REWRITE
}
 Error statuses for the wallet database. More...
 

Functions

void MaybeCompactWalletDB ()
 Compacts BDB state so that wallet.dat is self-contained (if there are changes) More...
 
bool ReadKeyValue (CWallet *pwallet, CDataStream &ssKey, CDataStream &ssValue, std::string &strType, std::string &strErr, const KeyFilterFn &filter_fn=nullptr)
 Unserialize a given Key-Value pair and load it into the wallet. More...
 
std::unique_ptr< WalletDatabaseCreateDummyWalletDatabase ()
 Return object for accessing dummy database with no read/write capabilities. More...
 
std::unique_ptr< WalletDatabaseCreateMockWalletDatabase ()
 Return object for accessing temporary in-memory database. More...
 

Variables

static const bool DEFAULT_FLUSHWALLET = true
 Overview of wallet database classes: More...
 

Typedef Documentation

◆ KeyFilterFn

using KeyFilterFn = std::function<bool(const std::string&)>

Callback for filtering key types to deserialize in ReadKeyValue.

Definition at line 283 of file walletdb.h.

Enumeration Type Documentation

◆ DBErrors

enum DBErrors
strong

Error statuses for the wallet database.

Enumerator
LOAD_OK 
CORRUPT 
NONCRITICAL_ERROR 
TOO_NEW 
LOAD_FAIL 
NEED_REWRITE 

Definition at line 44 of file walletdb.h.

Function Documentation

◆ CreateDummyWalletDatabase()

std::unique_ptr<WalletDatabase> CreateDummyWalletDatabase ( )

Return object for accessing dummy database with no read/write capabilities.

Definition at line 1036 of file walletdb.cpp.

Here is the caller graph for this function:

◆ CreateMockWalletDatabase()

std::unique_ptr<WalletDatabase> CreateMockWalletDatabase ( )

Return object for accessing temporary in-memory database.

Definition at line 1042 of file walletdb.cpp.

Here is the caller graph for this function:

◆ MaybeCompactWalletDB()

void MaybeCompactWalletDB ( )

Compacts BDB state so that wallet.dat is self-contained (if there are changes)

Definition at line 935 of file walletdb.cpp.

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

◆ ReadKeyValue()

bool ReadKeyValue ( CWallet pwallet,
CDataStream ssKey,
CDataStream ssValue,
std::string &  strType,
std::string &  strErr,
const KeyFilterFn filter_fn = nullptr 
)

Unserialize a given Key-Value pair and load it into the wallet.

Definition at line 677 of file walletdb.cpp.

Here is the call graph for this function:

Variable Documentation

◆ DEFAULT_FLUSHWALLET

const bool DEFAULT_FLUSHWALLET = true
static

Overview of wallet database classes:

  • WalletBatch is an abstract modifier object for the wallet database, and encapsulates a database batch update as well as methods to act on the database. It should be agnostic to the database implementation.

The following classes are implementation specific:

Definition at line 32 of file walletdb.h.