6 #ifndef BITCOIN_WALLET_WALLETDB_H 7 #define BITCOIN_WALLET_WALLETDB_H 73 template <
typename Stream,
typename Operation>
118 template <
typename Stream,
typename Operation>
155 template <
typename K,
typename T>
156 bool WriteIC(
const K&
key,
const T& value,
bool fOverwrite =
true)
168 template <
typename K>
183 m_batch(database, pszMode, _fFlushOnClose),
190 bool WriteName(
const std::string& strAddress,
const std::string& strName);
191 bool EraseName(
const std::string& strAddress);
193 bool WritePurpose(
const std::string& strAddress,
const std::string& purpose);
221 bool WriteDestData(
const std::string &address,
const std::string &
key,
const std::string &value);
230 static bool Recover(
const fs::path& wallet_path,
void *callbackDataIn,
bool (*recoverKVcallback)(
void* callbackData,
CDataStream ssKey,
CDataStream ssValue), std::string& out_backup_filename);
232 static bool Recover(
const fs::path& wallet_path, std::string& out_backup_filename);
236 static bool IsKeyType(
const std::string& strType);
238 static bool VerifyEnvironment(
const fs::path& wallet_path, std::string& errorStr);
240 static bool VerifyDatabaseFile(
const fs::path& wallet_path, std::string& warningStr, std::string& errorStr);
264 #endif // BITCOIN_WALLET_WALLETDB_H
static bool VerifyEnvironment(const fs::path &wallet_path, std::string &errorStr)
Definition: walletdb.cpp:737
std::atomic< unsigned int > nUpdateCounter
Definition: db.h:172
Definition: walletdb.h:152
void SetNull()
Definition: uint256.h:39
bool ReadBestBlock(CBlockLocator &locator)
Definition: walletdb.cpp:128
bool WriteOrderPosNext(int64_t nOrderPosNext)
Definition: walletdb.cpp:134
bool Erase(const K &key)
Definition: db.h:306
bool EraseWatchOnly(const CScript &script)
Definition: walletdb.cpp:114
bool WriteDestData(const std::string &address, const std::string &key, const std::string &value)
Write destination data key,value tuple to database.
Definition: walletdb.cpp:747
bool EraseName(const std::string &strAddress)
Definition: walletdb.cpp:33
bool WriteMinVersion(int nVersion)
Definition: walletdb.cpp:154
bool WriteWalletFlags(const uint64_t flags)
Definition: walletdb.cpp:763
static const int VERSION_HD_CHAIN_SPLIT
Definition: walletdb.h:67
uint32_t nExternalChainCounter
Definition: walletdb.h:62
bool TxnCommit()
Commit current transaction.
Definition: walletdb.cpp:773
bool WriteBestBlock(const CBlockLocator &locator)
Definition: walletdb.cpp:122
bool ErasePurpose(const std::string &strAddress)
Definition: walletdb.cpp:45
Definition: walletdb.h:59
DBErrors
Definition: walletdb.h:48
void Flush()
Definition: db.cpp:596
DBErrors ZapWalletTx(std::vector< CWalletTx > &vWtx)
Definition: walletdb.cpp:652
bool Write(const K &key, const T &value, bool fOverwrite=true)
Definition: db.h:281
bool WriteCScript(const uint160 &hash, const CScript &redeemScript)
Definition: walletdb.cpp:101
bool WritePurpose(const std::string &strAddress, const std::string &purpose)
Definition: walletdb.cpp:40
static const int CURRENT_VERSION
Definition: walletdb.h:68
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
Definition: key.h:24
bool EraseDestData(const std::string &address, const std::string &key)
Erase destination data tuple from wallet database.
Definition: walletdb.cpp:752
bool WriteWatchOnly(const CScript &script, const CKeyMetadata &keymeta)
Definition: walletdb.cpp:106
static bool RecoverKeysOnlyFilter(void *callbackData, CDataStream ssKey, CDataStream ssValue)
Definition: walletdb.cpp:714
BerkeleyBatch m_batch
Definition: walletdb.h:257
unsigned int uint32_t
Definition: stdint.h:21
CHDChain()
Definition: walletdb.h:71
bool WriteName(const std::string &strAddress, const std::string &strName)
Definition: walletdb.cpp:28
void MaybeCompactWalletDB()
Compacts BDB state so that wallet.dat is self-contained (if there are changes)
Definition: walletdb.cpp:669
unsigned long long uint64_t
Definition: stdint.h:22
static bool VerifyDatabaseFile(const fs::path &wallet_path, std::string &warningStr, std::string &errorStr)
Definition: walletdb.cpp:742
bool TxnBegin()
Begin a new transaction.
Definition: walletdb.cpp:768
bool WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey)
Definition: walletdb.cpp:96
Definition: streams.h:203
DBErrors ZapSelectTx(std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut)
Definition: walletdb.cpp:614
bool WriteKeyMetadata(const CKeyMetadata &meta, const CPubKey &pubkey, const bool overwrite)
Definition: walletdb.cpp:60
bool ReadPool(int64_t nPool, CKeyPool &keypool)
Definition: walletdb.cpp:139
bool ErasePool(int64_t nPool)
Definition: walletdb.cpp:149
void SerializationOp(Stream &s, Operation ser_action)
Definition: walletdb.h:74
void IncrementUpdateCounter()
Definition: db.cpp:611
int flags
Definition: bitcoin-tx.cpp:507
bool WriteCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret, const CKeyMetadata &keyMeta)
Definition: walletdb.cpp:80
bool WriteHDChain(const CHDChain &chain)
write the hdchain model (external chain child index counter)
Definition: walletdb.cpp:758
bool EraseTx(uint256 hash)
Definition: walletdb.cpp:55
Definition: keyorigin.h:12
int nVersion
Definition: walletdb.h:69
uint32_t nInternalChainCounter
Definition: walletdb.h:63
Definition: uint256.h:121
bool WriteVersion(int nVersion)
Write wallet version.
Definition: walletdb.cpp:788
static const int VERSION_HD_BASE
Definition: walletdb.h:66
bool WritePool(int64_t nPool, const CKeyPool &keypool)
Definition: walletdb.cpp:144
WalletBatch(WalletDatabase &database, const char *pszMode="r+", bool _fFlushOnClose=true)
Definition: walletdb.h:182
bool ReadVersion(int &nVersion)
Read wallet version.
Definition: walletdb.cpp:783
static const bool DEFAULT_FLUSHWALLET
Definition: walletdb.h:33
void clear()
Definition: keyorigin.h:30
DBErrors FindWalletTx(std::vector< uint256 > &vTxHash, std::vector< CWalletTx > &vWtx)
Definition: walletdb.cpp:555
bool WriteIC(const K &key, const T &value, bool fOverwrite=true)
Definition: walletdb.h:156
Definition: uint256.h:110
signed long long int64_t
Definition: stdint.h:18
bool WriteTx(const CWalletTx &wtx)
Definition: walletdb.cpp:50
static bool Recover(const fs::path &wallet_path, void *callbackDataIn, bool(*recoverKVcallback)(void *callbackData, CDataStream ssKey, CDataStream ssValue), std::string &out_backup_filename)
Definition: walletdb.cpp:702
WalletBatch & operator=(const WalletBatch &)=delete
WalletDatabase & m_database
Definition: walletdb.h:258
#define READWRITE(...)
Definition: serialize.h:184
bool TxnAbort()
Abort current transaction.
Definition: walletdb.cpp:778
static bool IsKeyType(const std::string &strType)
Definition: walletdb.cpp:439
ADD_SERIALIZE_METHODS
Definition: walletdb.h:72
bool WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, const CKeyMetadata &keyMeta)
Definition: walletdb.cpp:65
void SetNull()
Definition: walletdb.h:83
DBErrors LoadWallet(CWallet *pwallet)
Definition: walletdb.cpp:445
CKeyID seed_id
seed hash160
Definition: walletdb.h:64
bool EraseIC(const K &key)
Definition: walletdb.h:169