6 #ifndef BITCOIN_WALLET_WALLETDB_H 7 #define BITCOIN_WALLET_WALLETDB_H 32 static const bool DEFAULT_FLUSHWALLET =
true;
72 template <
typename Stream,
typename Operation>
114 template <
typename Stream,
typename Operation>
142 template <
typename K,
typename T>
143 bool WriteIC(
const K& key,
const T& value,
bool fOverwrite =
true)
152 template <
typename K>
164 m_batch(database, pszMode, _fFlushOnClose),
171 bool WriteName(
const std::string& strAddress,
const std::string& strName);
172 bool EraseName(
const std::string& strAddress);
174 bool WritePurpose(
const std::string& strAddress,
const std::string& purpose);
201 bool WriteDestData(
const std::string &address,
const std::string &key,
const std::string &value);
203 bool EraseDestData(
const std::string &address,
const std::string &key);
210 static bool Recover(
const fs::path& wallet_path,
void *callbackDataIn,
bool (*recoverKVcallback)(
void* callbackData,
CDataStream ssKey,
CDataStream ssValue), std::string& out_backup_filename);
212 static bool Recover(
const fs::path& wallet_path, std::string& out_backup_filename);
216 static bool IsKeyType(
const std::string& strType);
218 static bool VerifyEnvironment(
const fs::path& wallet_path, std::string& errorStr);
220 static bool VerifyDatabaseFile(
const fs::path& wallet_path, std::string& warningStr, std::string& errorStr);
244 #endif // BITCOIN_WALLET_WALLETDB_H bool TxnCommit()
Commit current transaction.
static const int CURRENT_VERSION
bool WriteName(const std::string &strAddress, const std::string &strName)
bool EraseIC(const K &key)
bool WriteVersion(int nVersion)
Write wallet version.
bool EraseDestData(const std::string &address, const std::string &key)
Erase destination data tuple from wallet database.
bool ErasePurpose(const std::string &strAddress)
bool ReadBestBlock(CBlockLocator &locator)
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
bool WriteCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret, const CKeyMetadata &keyMeta)
bool WriteIC(const K &key, const T &value, bool fOverwrite=true)
DBErrors FindWalletTx(std::vector< uint256 > &vTxHash, std::vector< CWalletTx > &vWtx)
DBErrors ZapSelectTx(std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut)
bool WriteMinVersion(int nVersion)
bool WriteHDChain(const CHDChain &chain)
write the hdchain model (external chain child index counter)
Private key encryption is done based on a CMasterKey, which holds a salt and random encryption key...
bool WriteWatchOnly(const CScript &script, const CKeyMetadata &keymeta)
bool Write(const K &key, const T &value, bool fOverwrite=true)
static bool VerifyDatabaseFile(const fs::path &wallet_path, std::string &warningStr, std::string &errorStr)
An instance of this class represents one database.
uint32_t nExternalChainCounter
bool TxnBegin()
Begin a new transaction.
Double ended buffer combining vector and stream-like interfaces.
DBErrors ZapWalletTx(std::vector< CWalletTx > &vWtx)
bool WriteTx(const CWalletTx &wtx)
WalletBatch(WalletDatabase &database, const char *pszMode="r+", bool _fFlushOnClose=true)
DBErrors LoadWallet(CWallet *pwallet)
DBErrors
Error statuses for the wallet database.
bool WriteWalletFlags(const uint64_t flags)
static bool Recover(const fs::path &wallet_path, void *callbackDataIn, bool(*recoverKVcallback)(void *callbackData, CDataStream ssKey, CDataStream ssValue), std::string &out_backup_filename)
void SerializationOp(Stream &s, Operation ser_action)
bool EraseWatchOnly(const CScript &script)
Access to the wallet database.
bool WriteBestBlock(const CBlockLocator &locator)
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
secure_allocator is defined in allocators.h CPrivKey is a serialized private key, with all parameters...
bool TxnAbort()
Abort current transaction.
bool WriteDestData(const std::string &address, const std::string &key, const std::string &value)
Write destination data key,value tuple to database.
static bool IsKeyType(const std::string &strType)
bool WriteCScript(const uint160 &hash, const CScript &redeemScript)
static bool VerifyEnvironment(const fs::path &wallet_path, std::string &errorStr)
WalletDatabase & m_database
void MaybeCompactWalletDB()
Compacts BDB state so that wallet.dat is self-contained (if there are changes)
An encapsulated public key.
bool WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey)
RAII class that provides access to a Berkeley database.
bool WriteOrderPosNext(int64_t nOrderPosNext)
A transaction with a bunch of additional info that only the owner cares about.
bool ErasePool(int64_t nPool)
bool WritePool(int64_t nPool, const CKeyPool &keypool)
void IncrementUpdateCounter()
Serialized script, used inside transaction inputs and outputs.
A reference to a CKey: the Hash360 of its serialized public key.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
bool WritePurpose(const std::string &strAddress, const std::string &purpose)
bool ReadPool(int64_t nPool, CKeyPool &keypool)
static const int VERSION_HD_CHAIN_SPLIT
bool ReadVersion(int &nVersion)
Read wallet version.
bool WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, const CKeyMetadata &keyMeta)
bool EraseTx(uint256 hash)
CKeyID seed_id
seed hash360
static bool RecoverKeysOnlyFilter(void *callbackData, CDataStream ssKey, CDataStream ssValue)
static const int VERSION_HD_BASE
WalletBatch & operator=(const WalletBatch &)=delete
uint32_t nInternalChainCounter
bool EraseName(const std::string &strAddress)