Bitcoin Core  22.99.0
P2P Digital Currency
walletdb.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2020 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_WALLET_WALLETDB_H
7 #define BITCOIN_WALLET_WALLETDB_H
8 
9 #include <amount.h>
10 #include <script/sign.h>
11 #include <wallet/db.h>
12 #include <wallet/walletutil.h>
13 #include <key.h>
14 
15 #include <stdint.h>
16 #include <string>
17 #include <vector>
18 
31 static const bool DEFAULT_FLUSHWALLET = true;
32 
33 struct CBlockLocator;
34 class CKeyPool;
35 class CMasterKey;
36 class CScript;
37 class CWallet;
38 class CWalletTx;
39 class uint160;
40 class uint256;
41 
43 enum class DBErrors
44 {
45  LOAD_OK,
46  CORRUPT,
48  TOO_NEW,
49  LOAD_FAIL,
51 };
52 
53 namespace DBKeys {
54 extern const std::string ACENTRY;
55 extern const std::string ACTIVEEXTERNALSPK;
56 extern const std::string ACTIVEINTERNALSPK;
57 extern const std::string BESTBLOCK;
58 extern const std::string BESTBLOCK_NOMERKLE;
59 extern const std::string CRYPTED_KEY;
60 extern const std::string CSCRIPT;
61 extern const std::string DEFAULTKEY;
62 extern const std::string DESTDATA;
63 extern const std::string FLAGS;
64 extern const std::string HDCHAIN;
65 extern const std::string KEY;
66 extern const std::string KEYMETA;
67 extern const std::string MASTER_KEY;
68 extern const std::string MINVERSION;
69 extern const std::string NAME;
70 extern const std::string OLD_KEY;
71 extern const std::string ORDERPOSNEXT;
72 extern const std::string POOL;
73 extern const std::string PURPOSE;
74 extern const std::string SETTINGS;
75 extern const std::string TX;
76 extern const std::string VERSION;
77 extern const std::string WALLETDESCRIPTOR;
78 extern const std::string WALLETDESCRIPTORCKEY;
79 extern const std::string WALLETDESCRIPTORKEY;
80 extern const std::string WATCHMETA;
81 extern const std::string WATCHS;
82 } // namespace DBKeys
83 
84 /* simple HD chain data model */
85 class CHDChain
86 {
87 public:
91 
92  static const int VERSION_HD_BASE = 1;
93  static const int VERSION_HD_CHAIN_SPLIT = 2;
95  int nVersion;
96 
97  CHDChain() { SetNull(); }
98 
100  {
101  READWRITE(obj.nVersion, obj.nExternalChainCounter, obj.seed_id);
102  if (obj.nVersion >= VERSION_HD_CHAIN_SPLIT) {
103  READWRITE(obj.nInternalChainCounter);
104  }
105  }
106 
107  void SetNull()
108  {
112  seed_id.SetNull();
113  }
114 
115  bool operator==(const CHDChain& chain) const
116  {
117  return seed_id == chain.seed_id;
118  }
119 };
120 
122 {
123 public:
124  static const int VERSION_BASIC=1;
125  static const int VERSION_WITH_HDDATA=10;
126  static const int VERSION_WITH_KEY_ORIGIN = 12;
128  int nVersion;
129  int64_t nCreateTime; // 0 means unknown
130  std::string hdKeypath; //optional HD/bip32 keypath. Still used to determine whether a key is a seed. Also kept for backwards compatibility
131  CKeyID hd_seed_id; //id of the HD seed used to derive this key
132  KeyOriginInfo key_origin; // Key origin info with path and fingerprint
133  bool has_key_origin = false;
134 
136  {
137  SetNull();
138  }
139  explicit CKeyMetadata(int64_t nCreateTime_)
140  {
141  SetNull();
142  nCreateTime = nCreateTime_;
143  }
144 
146  {
147  READWRITE(obj.nVersion, obj.nCreateTime);
148  if (obj.nVersion >= VERSION_WITH_HDDATA) {
149  READWRITE(obj.hdKeypath, obj.hd_seed_id);
150  }
151  if (obj.nVersion >= VERSION_WITH_KEY_ORIGIN)
152  {
153  READWRITE(obj.key_origin);
154  READWRITE(obj.has_key_origin);
155  }
156  }
157 
158  void SetNull()
159  {
161  nCreateTime = 0;
162  hdKeypath.clear();
164  key_origin.clear();
165  has_key_origin = false;
166  }
167 };
168 
177 {
178 private:
179  template <typename K, typename T>
180  bool WriteIC(const K& key, const T& value, bool fOverwrite = true)
181  {
182  if (!m_batch->Write(key, value, fOverwrite)) {
183  return false;
184  }
186  if (m_database.nUpdateCounter % 1000 == 0) {
187  m_batch->Flush();
188  }
189  return true;
190  }
191 
192  template <typename K>
193  bool EraseIC(const K& key)
194  {
195  if (!m_batch->Erase(key)) {
196  return false;
197  }
199  if (m_database.nUpdateCounter % 1000 == 0) {
200  m_batch->Flush();
201  }
202  return true;
203  }
204 
205 public:
206  explicit WalletBatch(WalletDatabase &database, bool _fFlushOnClose = true) :
207  m_batch(database.MakeBatch(_fFlushOnClose)),
208  m_database(database)
209  {
210  }
211  WalletBatch(const WalletBatch&) = delete;
212  WalletBatch& operator=(const WalletBatch&) = delete;
213 
214  bool WriteName(const std::string& strAddress, const std::string& strName);
215  bool EraseName(const std::string& strAddress);
216 
217  bool WritePurpose(const std::string& strAddress, const std::string& purpose);
218  bool ErasePurpose(const std::string& strAddress);
219 
220  bool WriteTx(const CWalletTx& wtx);
221  bool EraseTx(uint256 hash);
222 
223  bool WriteKeyMetadata(const CKeyMetadata& meta, const CPubKey& pubkey, const bool overwrite);
224  bool WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata &keyMeta);
225  bool WriteCryptedKey(const CPubKey& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, const CKeyMetadata &keyMeta);
226  bool WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey);
227 
228  bool WriteCScript(const uint160& hash, const CScript& redeemScript);
229 
230  bool WriteWatchOnly(const CScript &script, const CKeyMetadata &keymeta);
231  bool EraseWatchOnly(const CScript &script);
232 
233  bool WriteBestBlock(const CBlockLocator& locator);
234  bool ReadBestBlock(CBlockLocator& locator);
235 
236  bool WriteOrderPosNext(int64_t nOrderPosNext);
237 
238  bool ReadPool(int64_t nPool, CKeyPool& keypool);
239  bool WritePool(int64_t nPool, const CKeyPool& keypool);
240  bool ErasePool(int64_t nPool);
241 
242  bool WriteMinVersion(int nVersion);
243 
244  bool WriteDescriptorKey(const uint256& desc_id, const CPubKey& pubkey, const CPrivKey& privkey);
245  bool WriteCryptedDescriptorKey(const uint256& desc_id, const CPubKey& pubkey, const std::vector<unsigned char>& secret);
246  bool WriteDescriptor(const uint256& desc_id, const WalletDescriptor& descriptor);
247  bool WriteDescriptorDerivedCache(const CExtPubKey& xpub, const uint256& desc_id, uint32_t key_exp_index, uint32_t der_index);
248  bool WriteDescriptorParentCache(const CExtPubKey& xpub, const uint256& desc_id, uint32_t key_exp_index);
249  bool WriteDescriptorLastHardenedCache(const CExtPubKey& xpub, const uint256& desc_id, uint32_t key_exp_index);
250  bool WriteDescriptorCacheItems(const uint256& desc_id, const DescriptorCache& cache);
251 
253  bool WriteDestData(const std::string &address, const std::string &key, const std::string &value);
255  bool EraseDestData(const std::string &address, const std::string &key);
256 
257  bool WriteActiveScriptPubKeyMan(uint8_t type, const uint256& id, bool internal);
258  bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal);
259 
260  DBErrors LoadWallet(CWallet* pwallet);
261  DBErrors FindWalletTx(std::vector<uint256>& vTxHash, std::list<CWalletTx>& vWtx);
262  DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
263  /* Function to determine if a certain KV/key-type is a key (cryptographical key) type */
264  static bool IsKeyType(const std::string& strType);
265 
267  bool WriteHDChain(const CHDChain& chain);
268 
269  bool WriteWalletFlags(const uint64_t flags);
271  bool TxnBegin();
273  bool TxnCommit();
275  bool TxnAbort();
276 private:
277  std::unique_ptr<DatabaseBatch> m_batch;
279 };
280 
282 void MaybeCompactWalletDB();
283 
285 using KeyFilterFn = std::function<bool(const std::string&)>;
286 
288 bool ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, std::string& strType, std::string& strErr, const KeyFilterFn& filter_fn = nullptr);
289 
291 std::unique_ptr<WalletDatabase> CreateDummyWalletDatabase();
292 
294 std::unique_ptr<WalletDatabase> CreateMockWalletDatabase();
295 
296 #endif // BITCOIN_WALLET_WALLETDB_H
WalletBatch::WritePool
bool WritePool(int64_t nPool, const CKeyPool &keypool)
Definition: walletdb.cpp:192
WalletBatch::WriteDestData
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:1034
CKeyMetadata::VERSION_BASIC
static const int VERSION_BASIC
Definition: walletdb.h:124
WalletBatch::WriteDescriptor
bool WriteDescriptor(const uint256 &desc_id, const WalletDescriptor &descriptor)
Definition: walletdb.cpp:239
WalletBatch::IsKeyType
static bool IsKeyType(const std::string &strType)
Definition: walletdb.cpp:731
CHDChain::nExternalChainCounter
uint32_t nExternalChainCounter
Definition: walletdb.h:88
DBKeys::OLD_KEY
const std::string OLD_KEY
Definition: walletdb.cpp:46
WalletBatch::WriteCScript
bool WriteCScript(const uint160 &hash, const CScript &redeemScript)
Definition: walletdb.cpp:149
WalletBatch::WriteCryptedDescriptorKey
bool WriteCryptedDescriptorKey(const uint256 &desc_id, const CPubKey &pubkey, const std::vector< unsigned char > &secret)
Definition: walletdb.cpp:230
DBKeys::CSCRIPT
const std::string CSCRIPT
Definition: walletdb.cpp:36
WalletBatch::m_batch
std::unique_ptr< DatabaseBatch > m_batch
Definition: walletdb.h:277
WalletBatch::WriteName
bool WriteName(const std::string &strAddress, const std::string &strName)
Definition: walletdb.cpp:66
DBKeys::FLAGS
const std::string FLAGS
Definition: walletdb.cpp:39
WalletDatabase::IncrementUpdateCounter
virtual void IncrementUpdateCounter()=0
DEFAULT_FLUSHWALLET
static const bool DEFAULT_FLUSHWALLET
Overview of wallet database classes:
Definition: walletdb.h:31
DBKeys::BESTBLOCK
const std::string BESTBLOCK
Definition: walletdb.cpp:34
CKeyPool
A key from a CWallet's keypool.
Definition: scriptpubkeyman.h:101
CKeyMetadata::nVersion
int nVersion
Definition: walletdb.h:128
DBKeys::MASTER_KEY
const std::string MASTER_KEY
Definition: walletdb.cpp:43
DBErrors::NEED_REWRITE
@ NEED_REWRITE
WalletBatch::EraseTx
bool EraseTx(uint256 hash)
Definition: walletdb.cpp:93
flags
int flags
Definition: bitcoin-tx.cpp:512
DBKeys::ORDERPOSNEXT
const std::string ORDERPOSNEXT
Definition: walletdb.cpp:47
CHDChain::nVersion
int nVersion
Definition: walletdb.h:95
WalletBatch::LoadWallet
DBErrors LoadWallet(CWallet *pwallet)
Definition: walletdb.cpp:737
DBKeys::CRYPTED_KEY
const std::string CRYPTED_KEY
Definition: walletdb.cpp:35
CPrivKey
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...
Definition: key.h:24
DBKeys::WATCHS
const std::string WATCHS
Definition: walletdb.cpp:59
base_blob::SetNull
void SetNull()
Definition: uint256.h:39
WalletBatch::WriteMasterKey
bool WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey)
Definition: walletdb.cpp:144
DBErrors::NONCRITICAL_ERROR
@ NONCRITICAL_ERROR
CMasterKey
Private key encryption is done based on a CMasterKey, which holds a salt and random encryption key.
Definition: crypter.h:33
CKeyMetadata::hdKeypath
std::string hdKeypath
Definition: walletdb.h:130
WalletDatabase
An instance of this class represents one database.
Definition: db.h:103
CHDChain::VERSION_HD_CHAIN_SPLIT
static const int VERSION_HD_CHAIN_SPLIT
Definition: walletdb.h:93
CKeyID
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:22
CKeyMetadata::SERIALIZE_METHODS
SERIALIZE_METHODS(CKeyMetadata, obj)
Definition: walletdb.h:145
WalletBatch::WalletBatch
WalletBatch(WalletDatabase &database, bool _fFlushOnClose=true)
Definition: walletdb.h:206
DBKeys::VERSION
const std::string VERSION
Definition: walletdb.cpp:52
DBKeys::MINVERSION
const std::string MINVERSION
Definition: walletdb.cpp:44
db.h
WalletBatch::WriteActiveScriptPubKeyMan
bool WriteActiveScriptPubKeyMan(uint8_t type, const uint256 &id, bool internal)
Definition: walletdb.cpp:207
DBKeys::ACTIVEINTERNALSPK
const std::string ACTIVEINTERNALSPK
Definition: walletdb.cpp:32
WalletBatch::EraseActiveScriptPubKeyMan
bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal)
Definition: walletdb.cpp:213
WalletBatch::TxnCommit
bool TxnCommit()
Commit current transaction.
Definition: walletdb.cpp:1060
DBKeys::WATCHMETA
const std::string WATCHMETA
Definition: walletdb.cpp:58
WalletBatch::WriteDescriptorParentCache
bool WriteDescriptorParentCache(const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index)
Definition: walletdb.cpp:251
CreateMockWalletDatabase
std::unique_ptr< WalletDatabase > CreateMockWalletDatabase()
Return object for accessing temporary in-memory database.
Definition: walletdb.cpp:1156
DBKeys::WALLETDESCRIPTORCKEY
const std::string WALLETDESCRIPTORCKEY
Definition: walletdb.cpp:56
WalletBatch::m_database
WalletDatabase & m_database
Definition: walletdb.h:278
DBKeys::PURPOSE
const std::string PURPOSE
Definition: walletdb.cpp:49
WalletDatabase::nUpdateCounter
std::atomic< unsigned int > nUpdateCounter
Definition: db.h:148
walletutil.h
CKeyMetadata::has_key_origin
bool has_key_origin
Whether the key_origin is useful.
Definition: walletdb.h:133
WalletBatch::WriteDescriptorLastHardenedCache
bool WriteDescriptorLastHardenedCache(const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index)
Definition: walletdb.cpp:258
CKeyMetadata::VERSION_WITH_KEY_ORIGIN
static const int VERSION_WITH_KEY_ORIGIN
Definition: walletdb.h:126
CHDChain::VERSION_HD_BASE
static const int VERSION_HD_BASE
Definition: walletdb.h:92
DBKeys::KEYMETA
const std::string KEYMETA
Definition: walletdb.cpp:41
WalletBatch::EraseIC
bool EraseIC(const K &key)
Definition: walletdb.h:193
WalletBatch::ReadPool
bool ReadPool(int64_t nPool, CKeyPool &keypool)
Definition: walletdb.cpp:187
WalletBatch::WriteOrderPosNext
bool WriteOrderPosNext(int64_t nOrderPosNext)
Definition: walletdb.cpp:182
WalletBatch::EraseDestData
bool EraseDestData(const std::string &address, const std::string &key)
Erase destination data tuple from wallet database.
Definition: walletdb.cpp:1039
DBKeys::POOL
const std::string POOL
Definition: walletdb.cpp:48
DBKeys::WALLETDESCRIPTOR
const std::string WALLETDESCRIPTOR
Definition: walletdb.cpp:53
DBKeys::BESTBLOCK_NOMERKLE
const std::string BESTBLOCK_NOMERKLE
Definition: walletdb.cpp:33
DBKeys::KEY
const std::string KEY
Definition: walletdb.cpp:42
WalletBatch::WritePurpose
bool WritePurpose(const std::string &strAddress, const std::string &purpose)
Definition: walletdb.cpp:78
DBKeys::SETTINGS
const std::string SETTINGS
Definition: walletdb.cpp:50
WalletBatch::EraseWatchOnly
bool EraseWatchOnly(const CScript &script)
Definition: walletdb.cpp:162
CHDChain::nInternalChainCounter
uint32_t nInternalChainCounter
Definition: walletdb.h:89
DBKeys::DEFAULTKEY
const std::string DEFAULTKEY
Definition: walletdb.cpp:37
sign.h
WalletBatch::WriteBestBlock
bool WriteBestBlock(const CBlockLocator &locator)
Definition: walletdb.cpp:170
WalletBatch::ErasePool
bool ErasePool(int64_t nPool)
Definition: walletdb.cpp:197
WalletBatch::WriteDescriptorDerivedCache
bool WriteDescriptorDerivedCache(const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index, uint32_t der_index)
Definition: walletdb.cpp:244
KeyOriginInfo::clear
void clear()
Definition: keyorigin.h:23
uint256
256-bit opaque blob.
Definition: uint256.h:124
READWRITE
#define READWRITE(...)
Definition: serialize.h:147
WalletBatch::EraseName
bool EraseName(const std::string &strAddress)
Definition: walletdb.cpp:71
DBKeys
Definition: walletdb.cpp:29
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:404
WalletBatch::WriteHDChain
bool WriteHDChain(const CHDChain &chain)
write the hdchain model (external chain child index counter)
Definition: walletdb.cpp:1045
DBErrors::LOAD_OK
@ LOAD_OK
DBKeys::ACTIVEEXTERNALSPK
const std::string ACTIVEEXTERNALSPK
Definition: walletdb.cpp:31
ReadKeyValue
bool ReadKeyValue(CWallet *pwallet, CDataStream &ssKey, CDataStream &ssValue, std::string &strType, std::string &strErr, const KeyFilterFn &filter_fn=nullptr)
Unserialize a given Key-Value pair and load it into the wallet.
Definition: walletdb.cpp:724
DescriptorCache
Cache for single descriptor's derived extended pubkeys.
Definition: descriptor.h:19
CKeyMetadata::CKeyMetadata
CKeyMetadata()
Definition: walletdb.h:135
WalletBatch::ReadBestBlock
bool ReadBestBlock(CBlockLocator &locator)
Definition: walletdb.cpp:176
WalletBatch::WriteDescriptorKey
bool WriteDescriptorKey(const uint256 &desc_id, const CPubKey &pubkey, const CPrivKey &privkey)
Definition: walletdb.cpp:219
key.h
CHDChain::operator==
bool operator==(const CHDChain &chain) const
Definition: walletdb.h:115
CKeyMetadata::hd_seed_id
CKeyID hd_seed_id
Definition: walletdb.h:131
DBErrors
DBErrors
Error statuses for the wallet database.
Definition: walletdb.h:43
uint160
160-bit opaque blob.
Definition: uint256.h:113
CPubKey
An encapsulated public key.
Definition: pubkey.h:32
WalletBatch::WriteCryptedKey
bool WriteCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret, const CKeyMetadata &keyMeta)
Definition: walletdb.cpp:118
CreateDummyWalletDatabase
std::unique_ptr< WalletDatabase > CreateDummyWalletDatabase()
Return object for accessing dummy database with no read/write capabilities.
Definition: walletdb.cpp:1150
CHDChain::SetNull
void SetNull()
Definition: walletdb.h:107
CHDChain
Definition: walletdb.h:85
CWallet
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:226
CHDChain::seed_id
CKeyID seed_id
seed hash160
Definition: walletdb.h:90
CWalletTx
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:68
WalletBatch::FindWalletTx
DBErrors FindWalletTx(std::vector< uint256 > &vTxHash, std::list< CWalletTx > &vWtx)
Definition: walletdb.cpp:918
DBErrors::CORRUPT
@ CORRUPT
WalletBatch::WriteKeyMetadata
bool WriteKeyMetadata(const CKeyMetadata &meta, const CPubKey &pubkey, const bool overwrite)
Definition: walletdb.cpp:98
CKeyMetadata::VERSION_WITH_HDDATA
static const int VERSION_WITH_HDDATA
Definition: walletdb.h:125
CKeyMetadata::CKeyMetadata
CKeyMetadata(int64_t nCreateTime_)
Definition: walletdb.h:139
CHDChain::CURRENT_VERSION
static const int CURRENT_VERSION
Definition: walletdb.h:94
WalletBatch::WriteWatchOnly
bool WriteWatchOnly(const CScript &script, const CKeyMetadata &keymeta)
Definition: walletdb.cpp:154
CDataStream
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:204
CKeyMetadata::key_origin
KeyOriginInfo key_origin
Definition: walletdb.h:132
CKeyMetadata::nCreateTime
int64_t nCreateTime
Definition: walletdb.h:129
WalletBatch::WriteIC
bool WriteIC(const K &key, const T &value, bool fOverwrite=true)
Definition: walletdb.h:180
WalletBatch::WriteDescriptorCacheItems
bool WriteDescriptorCacheItems(const uint256 &desc_id, const DescriptorCache &cache)
Definition: walletdb.cpp:265
WalletBatch::ErasePurpose
bool ErasePurpose(const std::string &strAddress)
Definition: walletdb.cpp:83
WalletBatch::ZapSelectTx
DBErrors ZapSelectTx(std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut)
Definition: walletdb.cpp:969
WalletBatch::WriteMinVersion
bool WriteMinVersion(int nVersion)
Definition: walletdb.cpp:202
WalletDescriptor
Descriptor with some wallet metadata.
Definition: walletutil.h:75
WalletBatch::operator=
WalletBatch & operator=(const WalletBatch &)=delete
KeyFilterFn
std::function< bool(const std::string &)> KeyFilterFn
Callback for filtering key types to deserialize in ReadKeyValue.
Definition: walletdb.h:285
CHDChain::SERIALIZE_METHODS
SERIALIZE_METHODS(CHDChain, obj)
Definition: walletdb.h:99
DBKeys::ACENTRY
const std::string ACENTRY
Definition: walletdb.cpp:30
DBKeys::HDCHAIN
const std::string HDCHAIN
Definition: walletdb.cpp:40
WalletBatch::TxnBegin
bool TxnBegin()
Begin a new transaction.
Definition: walletdb.cpp:1055
WalletBatch::WriteTx
bool WriteTx(const CWalletTx &wtx)
Definition: walletdb.cpp:88
CBlockLocator
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
Definition: block.h:114
CKeyMetadata::CURRENT_VERSION
static const int CURRENT_VERSION
Definition: walletdb.h:127
WalletBatch::WriteKey
bool WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, const CKeyMetadata &keyMeta)
Definition: walletdb.cpp:103
WalletBatch
Access to the wallet database.
Definition: walletdb.h:176
amount.h
MaybeCompactWalletDB
void MaybeCompactWalletDB()
Compacts BDB state so that wallet.dat is self-contained (if there are changes)
Definition: walletdb.cpp:1007
DBKeys::TX
const std::string TX
Definition: walletdb.cpp:51
DBKeys::NAME
const std::string NAME
Definition: walletdb.cpp:45
CExtPubKey
Definition: pubkey.h:282
CKeyMetadata
Definition: walletdb.h:121
CKeyMetadata::SetNull
void SetNull()
Definition: walletdb.h:158
KeyOriginInfo
Definition: keyorigin.h:11
DBErrors::TOO_NEW
@ TOO_NEW
DBKeys::WALLETDESCRIPTORKEY
const std::string WALLETDESCRIPTORKEY
Definition: walletdb.cpp:57
DBErrors::LOAD_FAIL
@ LOAD_FAIL
WalletBatch::WriteWalletFlags
bool WriteWalletFlags(const uint64_t flags)
Definition: walletdb.cpp:1050
CHDChain::CHDChain
CHDChain()
Definition: walletdb.h:97
WalletBatch::TxnAbort
bool TxnAbort()
Abort current transaction.
Definition: walletdb.cpp:1065
DBKeys::DESTDATA
const std::string DESTDATA
Definition: walletdb.cpp:38