PIVX Core  5.6.99
P2P Digital Currency
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, const char *pszMode="r+", bool _fFlushOnClose=true)
 
 WalletBatch (const WalletBatch &)=delete
 
WalletBatchoperator= (const WalletBatch &)=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)
 
bool EraseWatchOnly (const CScript &script)
 
bool WriteBestBlock (const CBlockLocator &locator)
 
bool ReadBestBlock (CBlockLocator &locator)
 
bool WriteOrderPosNext (int64_t nOrderPosNext)
 
bool WriteStakeSplitThreshold (const CAmount &nStakeSplitThreshold)
 
bool WriteUseCustomFee (bool fUse)
 
bool WriteCustomFeeValue (const CAmount &nCustomFee)
 
bool WriteAutoCombineSettings (bool fEnable, CAmount nCombineThreshold, int frequency)
 
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 WriteHDChain (const CHDChain &chain)
 write the hdchain model (external/internal chain child index counter) More...
 
bool WriteSaplingZKey (const libzcash::SaplingIncomingViewingKey &ivk, const libzcash::SaplingExtendedSpendingKey &key, const CKeyMetadata &keyMeta)
 Write extended spending key to wallet database, where the key is the incoming viewing key. More...
 
bool WriteSaplingPaymentAddress (const libzcash::SaplingPaymentAddress &addr, const libzcash::SaplingIncomingViewingKey &ivk)
 
bool WriteCryptedSaplingZKey (const libzcash::SaplingExtendedFullViewingKey &extfvk, const std::vector< unsigned char > &vchCryptedSecret, const CKeyMetadata &keyMeta)
 
bool WriteSaplingCommonOVK (const uint256 &ovk)
 Common output viewing key, used when shielding transparent funds. More...
 
bool ReadSaplingCommonOVK (uint256 &ovkRet)
 
bool WriteWitnessCacheSize (int64_t nWitnessCacheSize)
 
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...
 
DBErrors ReorderTransactions (CWallet *pwallet)
 
DBErrors LoadWallet (CWallet *pwallet)
 
DBErrors FindWalletTx (CWallet *pwallet, std::vector< uint256 > &vTxHash, std::vector< CWalletTx > &vWtx)
 
DBErrors ZapWalletTx (CWallet *pwallet, std::vector< CWalletTx > &vWtx)
 
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 fs::path &wallet_path, void *callbackDataIn, bool(*recoverKVcallback)(void *callbackData, CDataStream ssKey, CDataStream ssValue), std::string &out_backup_filename)
 
static bool Recover (const fs::path &wallet_path, 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 fs::path &wallet_path, std::string &errorStr)
 
static bool VerifyDatabaseFile (const fs::path &wallet_path, 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

BerkeleyBatch m_batch
 
WalletDatabasem_database
 

Detailed Description

Access to the wallet database.

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

Constructor & Destructor Documentation

◆ WalletBatch() [1/2]

WalletBatch::WalletBatch ( WalletDatabase database,
const char *  pszMode = "r+",
bool  _fFlushOnClose = true 
)
inlineexplicit

Definition at line 135 of file walletdb.h.

◆ WalletBatch() [2/2]

WalletBatch::WalletBatch ( const WalletBatch )
delete

Member Function Documentation

◆ EraseDestData()

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

Erase destination data tuple from wallet database.

Definition at line 964 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 125 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 std::string &  strAddress)

Definition at line 75 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 265 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 std::string &  strAddress)

Definition at line 87 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 97 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 206 of file walletdb.cpp.

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

◆ FindWalletTx()

DBErrors WalletBatch::FindWalletTx ( CWallet pwallet,
std::vector< uint256 > &  vTxHash,
std::vector< CWalletTx > &  vWtx 
)

Definition at line 735 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 628 of file walletdb.cpp.

Here is the caller graph for this function:

◆ LoadWallet()

DBErrors WalletBatch::LoadWallet ( CWallet pwallet)

Definition at line 635 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 217 of file walletdb.cpp.

Here is the call graph for this function:

◆ ReadPool()

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

Definition at line 255 of file walletdb.cpp.

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

◆ ReadSaplingCommonOVK()

bool WalletBatch::ReadSaplingCommonOVK ( uint256 ovkRet)

Definition at line 181 of file walletdb.cpp.

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

◆ ReadVersion()

bool WalletBatch::ReadVersion ( int &  nVersion)

Read wallet version.

Definition at line 984 of file walletdb.cpp.

Here is the call graph for this function:

◆ Recover() [1/2]

bool WalletBatch::Recover ( const fs::path &  wallet_path,
std::string &  out_backup_filename 
)
static

Definition at line 919 of file walletdb.cpp.

Here is the call graph for this function:

◆ Recover() [2/2]

bool WalletBatch::Recover ( const fs::path &  wallet_path,
void *  callbackDataIn,
bool(*)(void *callbackData, CDataStream ssKey, CDataStream ssValue)  recoverKVcallback,
std::string &  out_backup_filename 
)
static

Definition at line 914 of file walletdb.cpp.

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

◆ RecoverKeysOnlyFilter()

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

Definition at line 926 of file walletdb.cpp.

Here is the call graph for this function:

◆ ReorderTransactions()

DBErrors WalletBatch::ReorderTransactions ( CWallet pwallet)

Definition at line 282 of file walletdb.cpp.

Here is the call graph for this function:

◆ TxnAbort()

bool WalletBatch::TxnAbort ( )

Abort current transaction.

Definition at line 979 of file walletdb.cpp.

Here is the call graph for this function:

◆ TxnBegin()

bool WalletBatch::TxnBegin ( )

Begin a new transaction.

Definition at line 969 of file walletdb.cpp.

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

◆ TxnCommit()

bool WalletBatch::TxnCommit ( )

Commit current transaction.

Definition at line 974 of file walletdb.cpp.

Here is the call graph for this function:

◆ VerifyDatabaseFile()

bool WalletBatch::VerifyDatabaseFile ( const fs::path &  wallet_path,
std::string &  warningStr,
std::string &  errorStr 
)
static

Definition at line 954 of file walletdb.cpp.

Here is the call graph for this function:

◆ VerifyEnvironment()

bool WalletBatch::VerifyEnvironment ( const fs::path &  wallet_path,
std::string &  errorStr 
)
static

Definition at line 949 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteAutoCombineSettings()

bool WalletBatch::WriteAutoCombineSettings ( bool  fEnable,
CAmount  nCombineThreshold,
int  frequency 
)

Definition at line 245 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteBestBlock()

bool WalletBatch::WriteBestBlock ( const CBlockLocator locator)

Definition at line 211 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteCryptedKey()

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

Definition at line 117 of file walletdb.cpp.

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

◆ WriteCryptedSaplingZKey()

bool WalletBatch::WriteCryptedSaplingZKey ( const libzcash::SaplingExtendedFullViewingKey extfvk,
const std::vector< unsigned char > &  vchCryptedSecret,
const CKeyMetadata keyMeta 
)

Definition at line 154 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 196 of file walletdb.cpp.

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

◆ WriteCustomFeeValue()

bool WalletBatch::WriteCustomFeeValue ( const CAmount nCustomFee)

Definition at line 240 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 std::string &  address,
const std::string &  key,
const std::string &  value 
)

Write destination data key,value tuple to database.

Definition at line 959 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/internal chain child index counter)

Definition at line 275 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 115 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 102 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 191 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteMinVersion()

bool WalletBatch::WriteMinVersion ( int  nVersion)

Definition at line 270 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 std::string &  strAddress,
const std::string &  strName 
)

Definition at line 70 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 225 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 260 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 std::string &  strAddress,
const std::string &  purpose 
)

Definition at line 82 of file walletdb.cpp.

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

◆ WriteSaplingCommonOVK()

bool WalletBatch::WriteSaplingCommonOVK ( const uint256 ovk)

Common output viewing key, used when shielding transparent funds.

Definition at line 176 of file walletdb.cpp.

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

◆ WriteSaplingPaymentAddress()

bool WalletBatch::WriteSaplingPaymentAddress ( const libzcash::SaplingPaymentAddress addr,
const libzcash::SaplingIncomingViewingKey ivk 
)

Definition at line 148 of file walletdb.cpp.

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

◆ WriteSaplingZKey()

bool WalletBatch::WriteSaplingZKey ( const libzcash::SaplingIncomingViewingKey ivk,
const libzcash::SaplingExtendedSpendingKey key,
const CKeyMetadata keyMeta 
)

Write extended spending key to wallet database, where the key is the incoming viewing key.

Definition at line 137 of file walletdb.cpp.

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

◆ WriteStakeSplitThreshold()

bool WalletBatch::WriteStakeSplitThreshold ( const CAmount nStakeSplitThreshold)

Definition at line 230 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 92 of file walletdb.cpp.

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

◆ WriteUseCustomFee()

bool WalletBatch::WriteUseCustomFee ( bool  fUse)

Definition at line 235 of file walletdb.cpp.

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

◆ WriteVersion()

bool WalletBatch::WriteVersion ( int  nVersion)

Write wallet version.

Definition at line 989 of file walletdb.cpp.

Here is the call graph for this function:

◆ WriteWatchOnly()

bool WalletBatch::WriteWatchOnly ( const CScript script)

Definition at line 201 of file walletdb.cpp.

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

◆ WriteWitnessCacheSize()

bool WalletBatch::WriteWitnessCacheSize ( int64_t  nWitnessCacheSize)

Definition at line 186 of file walletdb.cpp.

Here is the call graph for this function:

◆ ZapWalletTx()

DBErrors WalletBatch::ZapWalletTx ( CWallet pwallet,
std::vector< CWalletTx > &  vWtx 
)

Definition at line 795 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

BerkeleyBatch WalletBatch::m_batch
private

Definition at line 231 of file walletdb.h.

◆ m_database

WalletDatabase& WalletBatch::m_database
private

Definition at line 232 of file walletdb.h.


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