Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
WalletBatch Class Reference

Access to the wallet database. More...

#include <walletdb.h>

Collaboration diagram for WalletBatch:
[legend]

Public Member Functions

 WalletBatch (WalletDatabase &database, bool _fFlushOnClose=true)
 
 WalletBatch (const WalletBatch &)=delete
 
WalletBatchoperator= (const WalletBatch &)=delete
 
bool WriteName (const CTxDestination &address, const std::string &strName)
 
bool EraseName (const CTxDestination &address)
 
bool WritePurpose (const CTxDestination &address, const std::string &purpose)
 
bool ErasePurpose (const CTxDestination &address)
 
bool WriteTx (const CWalletTx &wtx)
 
bool EraseTx (uint256 hash)
 
bool WriteKeyMetadata (const CKeyMetadata &meta, const CPubKey &pubkey, const bool overwrite)
 
bool WriteKey (const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, const CKeyMetadata &keyMeta)
 
bool WriteCryptedKey (const CPubKey &vchPubKey, const std::vector< uint8_t > &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 WriteDescriptorKey (const uint256 &desc_id, const CPubKey &pubkey, const CPrivKey &privkey)
 
bool WriteCryptedDescriptorKey (const uint256 &desc_id, const CPubKey &pubkey, const std::vector< uint8_t > &secret)
 
bool WriteDescriptor (const uint256 &desc_id, const WalletDescriptor &descriptor)
 
bool WriteDescriptorDerivedCache (const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index, uint32_t der_index)
 
bool WriteDescriptorParentCache (const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index)
 
bool WriteDestData (const CTxDestination &address, const std::string &key, const std::string &value)
 Write destination data key,value tuple to database.
 
bool EraseDestData (const CTxDestination &address, const std::string &key)
 Erase destination data tuple from wallet database.
 
bool WriteActiveScriptPubKeyMan (uint8_t type, const uint256 &id, bool internal)
 
bool EraseActiveScriptPubKeyMan (uint8_t type, bool internal)
 
DBErrors LoadWallet (CWallet *pwallet)
 
DBErrors FindWalletTx (std::vector< TxId > &txIds, std::list< CWalletTx > &vWtx)
 
DBErrors ZapSelectTx (std::vector< TxId > &txIdsIn, std::vector< TxId > &txIdsOut)
 
bool WriteHDChain (const CHDChain &chain)
 write the hdchain model (external chain child index counter)
 
bool WriteWalletFlags (const uint64_t flags)
 
bool TxnBegin ()
 Begin a new transaction.
 
bool TxnCommit ()
 Commit current transaction.
 
bool TxnAbort ()
 Abort current transaction.
 

Static Public Member Functions

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

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

std::unique_ptr< DatabaseBatchm_batch
 
WalletDatabasem_database
 

Detailed Description

Access to the wallet database.

Opens the database and provides read and write access to it. Each read and write is its own transaction. Multiple operation transactions can be started using TxnBegin() and committed using TxnCommit() Otherwise the transaction will be committed when the object goes out of scope. Optionally (on by default) it will flush to disk on close. Every 1000 writes will automatically trigger a flush to disk.

Definition at line 175 of file walletdb.h.

Constructor & Destructor Documentation

◆ WalletBatch() [1/2]

WalletBatch::WalletBatch ( WalletDatabase database,
bool  _fFlushOnClose = true 
)
inlineexplicit

Definition at line 201 of file walletdb.h.

◆ WalletBatch() [2/2]

WalletBatch::WalletBatch ( const WalletBatch )
delete

Member Function Documentation

◆ EraseActiveScriptPubKeyMan()

bool WalletBatch::EraseActiveScriptPubKeyMan ( uint8_t  type,
bool  internal 
)

Definition at line 220 of file walletdb.cpp.

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

◆ EraseDestData()

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

Erase destination data tuple from wallet database.

Definition at line 1090 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 WalletBatch::EraseIC ( const K key)
inlineprivate

Definition at line 189 of file walletdb.h.

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

◆ EraseName()

bool WalletBatch::EraseName ( const CTxDestination address)

Definition at line 70 of file walletdb.cpp.

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

◆ ErasePool()

bool WalletBatch::ErasePool ( int64_t  nPool)

Definition at line 205 of file walletdb.cpp.

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

◆ ErasePurpose()

bool WalletBatch::ErasePurpose ( const CTxDestination address)

Definition at line 91 of file walletdb.cpp.

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

◆ EraseTx()

bool WalletBatch::EraseTx ( uint256  hash)

Definition at line 103 of file walletdb.cpp.

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

◆ EraseWatchOnly()

bool WalletBatch::EraseWatchOnly ( const CScript script)

Definition at line 172 of file walletdb.cpp.

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

◆ FindWalletTx()

DBErrors WalletBatch::FindWalletTx ( std::vector< TxId > &  txIds,
std::list< CWalletTx > &  vWtx 
)

Definition at line 956 of file walletdb.cpp.

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

◆ IsKeyType()

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

Definition at line 769 of file walletdb.cpp.

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

◆ LoadWallet()

DBErrors WalletBatch::LoadWallet ( CWallet pwallet)

Definition at line 774 of file walletdb.cpp.

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

◆ operator=()

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

◆ ReadBestBlock()

bool WalletBatch::ReadBestBlock ( CBlockLocator locator)

Definition at line 186 of file walletdb.cpp.

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

◆ ReadPool()

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

Definition at line 197 of file walletdb.cpp.

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

◆ TxnAbort()

bool WalletBatch::TxnAbort ( )

Abort current transaction.

Definition at line 1116 of file walletdb.cpp.

◆ TxnBegin()

bool WalletBatch::TxnBegin ( )

Begin a new transaction.

Definition at line 1108 of file walletdb.cpp.

◆ TxnCommit()

bool WalletBatch::TxnCommit ( )

Commit current transaction.

Definition at line 1112 of file walletdb.cpp.

◆ WriteActiveScriptPubKeyMan()

bool WalletBatch::WriteActiveScriptPubKeyMan ( uint8_t  type,
const uint256 id,
bool  internal 
)

Definition at line 213 of file walletdb.cpp.

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

◆ WriteBestBlock()

bool WalletBatch::WriteBestBlock ( const CBlockLocator locator)

Definition at line 179 of file walletdb.cpp.

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

◆ WriteCryptedDescriptorKey()

bool WalletBatch::WriteCryptedDescriptorKey ( const uint256 desc_id,
const CPubKey pubkey,
const std::vector< uint8_t > &  secret 
)

Definition at line 240 of file walletdb.cpp.

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

◆ WriteCryptedKey()

bool WalletBatch::WriteCryptedKey ( const CPubKey vchPubKey,
const std::vector< uint8_t > &  vchCryptedSecret,
const CKeyMetadata keyMeta 
)

Definition at line 129 of file walletdb.cpp.

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

◆ WriteCScript()

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

Definition at line 159 of file walletdb.cpp.

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

◆ WriteDescriptor()

bool WalletBatch::WriteDescriptor ( const uint256 desc_id,
const WalletDescriptor descriptor 
)

Definition at line 253 of file walletdb.cpp.

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

◆ WriteDescriptorDerivedCache()

bool WalletBatch::WriteDescriptorDerivedCache ( const CExtPubKey xpub,
const uint256 desc_id,
uint32_t  key_exp_index,
uint32_t  der_index 
)

Definition at line 258 of file walletdb.cpp.

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

◆ WriteDescriptorKey()

bool WalletBatch::WriteDescriptorKey ( const uint256 desc_id,
const CPubKey pubkey,
const CPrivKey privkey 
)

Definition at line 226 of file walletdb.cpp.

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

◆ WriteDescriptorParentCache()

bool WalletBatch::WriteDescriptorParentCache ( const CExtPubKey xpub,
const uint256 desc_id,
uint32_t  key_exp_index 
)

Definition at line 270 of file walletdb.cpp.

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

◆ WriteDestData()

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

Write destination data key,value tuple to database.

Definition at line 1077 of file walletdb.cpp.

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

◆ WriteHDChain()

bool WalletBatch::WriteHDChain ( const CHDChain chain)

write the hdchain model (external chain child index counter)

Definition at line 1100 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 WalletBatch::WriteIC ( const K key,
const T &  value,
bool  fOverwrite = true 
)
inlineprivate

Definition at line 178 of file walletdb.h.

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

◆ WriteKey()

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

Definition at line 113 of file walletdb.cpp.

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

◆ WriteKeyMetadata()

bool WalletBatch::WriteKeyMetadata ( const CKeyMetadata meta,
const CPubKey pubkey,
const bool  overwrite 
)

Definition at line 107 of file walletdb.cpp.

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

◆ WriteMasterKey()

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

Definition at line 154 of file walletdb.cpp.

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

◆ WriteMinVersion()

bool WalletBatch::WriteMinVersion ( int  nVersion)

Definition at line 209 of file walletdb.cpp.

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

◆ WriteName()

bool WalletBatch::WriteName ( const CTxDestination address,
const std::string &  strName 
)

Definition at line 60 of file walletdb.cpp.

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

◆ WriteOrderPosNext()

bool WalletBatch::WriteOrderPosNext ( int64_t  nOrderPosNext)

Definition at line 193 of file walletdb.cpp.

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

◆ WritePool()

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

Definition at line 201 of file walletdb.cpp.

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

◆ WritePurpose()

bool WalletBatch::WritePurpose ( const CTxDestination address,
const std::string &  purpose 
)

Definition at line 81 of file walletdb.cpp.

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

◆ WriteTx()

bool WalletBatch::WriteTx ( const CWalletTx wtx)

Definition at line 99 of file walletdb.cpp.

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

◆ WriteWalletFlags()

bool WalletBatch::WriteWalletFlags ( const uint64_t  flags)

Definition at line 1104 of file walletdb.cpp.

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

◆ WriteWatchOnly()

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

Definition at line 164 of file walletdb.cpp.

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

◆ ZapSelectTx()

DBErrors WalletBatch::ZapSelectTx ( std::vector< TxId > &  txIdsIn,
std::vector< TxId > &  txIdsOut 
)

Definition at line 1008 of file walletdb.cpp.

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

Member Data Documentation

◆ m_batch

std::unique_ptr<DatabaseBatch> WalletBatch::m_batch
private

Definition at line 286 of file walletdb.h.

◆ m_database

WalletDatabase& WalletBatch::m_database
private

Definition at line 287 of file walletdb.h.


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