![]() |
Bitcoin Core 29.99.0
P2P Digital Currency
|
Access to the wallet database. More...
#include <walletdb.h>
Public Member Functions | |
WalletBatch (WalletDatabase &database, bool _fFlushOnClose=true) | |
WalletBatch (const WalletBatch &)=delete | |
WalletBatch & | operator= (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 | 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< unsigned char > &vchCryptedSecret, const CKeyMetadata &keyMeta) |
bool | WriteMasterKey (unsigned int nID, const CMasterKey &kMasterKey) |
bool | EraseMasterKey (unsigned int id) |
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 | IsEncrypted () |
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< unsigned char > &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 | WriteDescriptorLastHardenedCache (const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index) |
bool | WriteDescriptorCacheItems (const uint256 &desc_id, const DescriptorCache &cache) |
bool | WriteLockedUTXO (const COutPoint &output) |
bool | EraseLockedUTXO (const COutPoint &output) |
bool | WriteAddressPreviouslySpent (const CTxDestination &dest, bool previously_spent) |
bool | WriteAddressReceiveRequest (const CTxDestination &dest, const std::string &id, const std::string &receive_request) |
bool | EraseAddressReceiveRequest (const CTxDestination &dest, const std::string &id) |
bool | EraseAddressData (const CTxDestination &dest) |
bool | WriteActiveScriptPubKeyMan (uint8_t type, const uint256 &id, bool internal) |
bool | EraseActiveScriptPubKeyMan (uint8_t type, bool internal) |
DBErrors | LoadWallet (CWallet *pwallet) |
bool | WriteHDChain (const CHDChain &chain) |
write the hdchain model (external chain child index counter) More... | |
bool | EraseRecords (const std::unordered_set< std::string > &types) |
Delete records of the given types. More... | |
bool | WriteWalletFlags (const uint64_t flags) |
bool | TxnBegin () |
Begin a new transaction. More... | |
bool | TxnCommit () |
Commit current transaction. More... | |
bool | TxnAbort () |
Abort current transaction. More... | |
bool | HasActiveTxn () |
void | RegisterTxnListener (const DbTxnListener &l) |
Registers db txn callback functions. More... | |
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< DatabaseBatch > | m_batch |
WalletDatabase & | m_database |
std::vector< DbTxnListener > | m_txn_listeners |
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 195 of file walletdb.h.
|
inlineexplicit |
Definition at line 225 of file walletdb.h.
|
delete |
bool wallet::WalletBatch::EraseActiveScriptPubKeyMan | ( | uint8_t | type, |
bool | internal | ||
) |
Definition at line 235 of file walletdb.cpp.
bool wallet::WalletBatch::EraseAddressData | ( | const CTxDestination & | dest | ) |
Definition at line 1345 of file walletdb.cpp.
bool wallet::WalletBatch::EraseAddressReceiveRequest | ( | const CTxDestination & | dest, |
const std::string & | id | ||
) |
Definition at line 1340 of file walletdb.cpp.
|
inlineprivate |
Definition at line 212 of file walletdb.h.
bool wallet::WalletBatch::EraseLockedUTXO | ( | const COutPoint & | output | ) |
Definition at line 314 of file walletdb.cpp.
bool wallet::WalletBatch::EraseMasterKey | ( | unsigned int | id | ) |
bool wallet::WalletBatch::EraseName | ( | const std::string & | strAddress | ) |
Definition at line 77 of file walletdb.cpp.
bool wallet::WalletBatch::ErasePool | ( | int64_t | nPool | ) |
Definition at line 219 of file walletdb.cpp.
bool wallet::WalletBatch::ErasePurpose | ( | const std::string & | strAddress | ) |
Definition at line 89 of file walletdb.cpp.
bool wallet::WalletBatch::EraseRecords | ( | const std::unordered_set< std::string > & | types | ) |
Delete records of the given types.
Definition at line 1362 of file walletdb.cpp.
bool wallet::WalletBatch::EraseTx | ( | uint256 | hash | ) |
Definition at line 99 of file walletdb.cpp.
bool wallet::WalletBatch::EraseWatchOnly | ( | const CScript & | script | ) |
Definition at line 173 of file walletdb.cpp.
|
inline |
bool wallet::WalletBatch::IsEncrypted | ( | ) |
Definition at line 193 of file walletdb.cpp.
Definition at line 1171 of file walletdb.cpp.
|
delete |
bool wallet::WalletBatch::ReadBestBlock | ( | CBlockLocator & | locator | ) |
bool wallet::WalletBatch::ReadPool | ( | int64_t | nPool, |
CKeyPool & | keypool | ||
) |
void wallet::WalletBatch::RegisterTxnListener | ( | const DbTxnListener & | l | ) |
Registers db txn callback functions.
Definition at line 1400 of file walletdb.cpp.
bool wallet::WalletBatch::TxnAbort | ( | ) |
Abort current transaction.
Definition at line 1387 of file walletdb.cpp.
bool wallet::WalletBatch::TxnBegin | ( | ) |
Begin a new transaction.
Definition at line 1369 of file walletdb.cpp.
bool wallet::WalletBatch::TxnCommit | ( | ) |
Commit current transaction.
Definition at line 1374 of file walletdb.cpp.
bool wallet::WalletBatch::WriteActiveScriptPubKeyMan | ( | uint8_t | type, |
const uint256 & | id, | ||
bool | internal | ||
) |
Definition at line 229 of file walletdb.cpp.
bool wallet::WalletBatch::WriteAddressPreviouslySpent | ( | const CTxDestination & | dest, |
bool | previously_spent | ||
) |
Definition at line 1329 of file walletdb.cpp.
bool wallet::WalletBatch::WriteAddressReceiveRequest | ( | const CTxDestination & | dest, |
const std::string & | id, | ||
const std::string & | receive_request | ||
) |
Definition at line 1335 of file walletdb.cpp.
bool wallet::WalletBatch::WriteBestBlock | ( | const CBlockLocator & | locator | ) |
Definition at line 181 of file walletdb.cpp.
bool wallet::WalletBatch::WriteCryptedDescriptorKey | ( | const uint256 & | desc_id, |
const CPubKey & | pubkey, | ||
const std::vector< unsigned char > & | secret | ||
) |
Definition at line 252 of file walletdb.cpp.
bool wallet::WalletBatch::WriteCryptedKey | ( | const CPubKey & | vchPubKey, |
const std::vector< unsigned char > & | vchCryptedSecret, | ||
const CKeyMetadata & | keyMeta | ||
) |
Definition at line 124 of file walletdb.cpp.
Definition at line 160 of file walletdb.cpp.
bool wallet::WalletBatch::WriteDescriptor | ( | const uint256 & | desc_id, |
const WalletDescriptor & | descriptor | ||
) |
Definition at line 261 of file walletdb.cpp.
bool wallet::WalletBatch::WriteDescriptorCacheItems | ( | const uint256 & | desc_id, |
const DescriptorCache & | cache | ||
) |
Definition at line 287 of file walletdb.cpp.
bool wallet::WalletBatch::WriteDescriptorDerivedCache | ( | const CExtPubKey & | xpub, |
const uint256 & | desc_id, | ||
uint32_t | key_exp_index, | ||
uint32_t | der_index | ||
) |
Definition at line 266 of file walletdb.cpp.
bool wallet::WalletBatch::WriteDescriptorKey | ( | const uint256 & | desc_id, |
const CPubKey & | pubkey, | ||
const CPrivKey & | privkey | ||
) |
Definition at line 241 of file walletdb.cpp.
bool wallet::WalletBatch::WriteDescriptorLastHardenedCache | ( | const CExtPubKey & | xpub, |
const uint256 & | desc_id, | ||
uint32_t | key_exp_index | ||
) |
Definition at line 280 of file walletdb.cpp.
bool wallet::WalletBatch::WriteDescriptorParentCache | ( | const CExtPubKey & | xpub, |
const uint256 & | desc_id, | ||
uint32_t | key_exp_index | ||
) |
Definition at line 273 of file walletdb.cpp.
bool wallet::WalletBatch::WriteHDChain | ( | const CHDChain & | chain | ) |
write the hdchain model (external chain child index counter)
Definition at line 1352 of file walletdb.cpp.
|
inlineprivate |
Definition at line 199 of file walletdb.h.
bool wallet::WalletBatch::WriteKey | ( | const CPubKey & | vchPubKey, |
const CPrivKey & | vchPrivKey, | ||
const CKeyMetadata & | keyMeta | ||
) |
Definition at line 109 of file walletdb.cpp.
bool wallet::WalletBatch::WriteKeyMetadata | ( | const CKeyMetadata & | meta, |
const CPubKey & | pubkey, | ||
const bool | overwrite | ||
) |
Definition at line 104 of file walletdb.cpp.
bool wallet::WalletBatch::WriteLockedUTXO | ( | const COutPoint & | output | ) |
Definition at line 309 of file walletdb.cpp.
bool wallet::WalletBatch::WriteMasterKey | ( | unsigned int | nID, |
const CMasterKey & | kMasterKey | ||
) |
Definition at line 150 of file walletdb.cpp.
bool wallet::WalletBatch::WriteMinVersion | ( | int | nVersion | ) |
Definition at line 224 of file walletdb.cpp.
bool wallet::WalletBatch::WriteName | ( | const std::string & | strAddress, |
const std::string & | strName | ||
) |
Definition at line 72 of file walletdb.cpp.
bool wallet::WalletBatch::WriteOrderPosNext | ( | int64_t | nOrderPosNext | ) |
Definition at line 204 of file walletdb.cpp.
bool wallet::WalletBatch::WritePool | ( | int64_t | nPool, |
const CKeyPool & | keypool | ||
) |
Definition at line 214 of file walletdb.cpp.
bool wallet::WalletBatch::WritePurpose | ( | const std::string & | strAddress, |
const std::string & | purpose | ||
) |
Definition at line 84 of file walletdb.cpp.
bool wallet::WalletBatch::WriteTx | ( | const CWalletTx & | wtx | ) |
Definition at line 94 of file walletdb.cpp.
bool wallet::WalletBatch::WriteWalletFlags | ( | const uint64_t | flags | ) |
bool wallet::WalletBatch::WriteWatchOnly | ( | const CScript & | script, |
const CKeyMetadata & | keymeta | ||
) |
Definition at line 165 of file walletdb.cpp.
|
private |
Definition at line 307 of file walletdb.h.
|
private |
Definition at line 308 of file walletdb.h.
|
private |
Definition at line 312 of file walletdb.h.