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 <script/sign.h>
10 #include <wallet/db.h>
11 #include <wallet/walletutil.h>
12 #include <key.h>
13 
14 #include <stdint.h>
15 #include <string>
16 #include <vector>
17 
30 static const bool DEFAULT_FLUSHWALLET = true;
31 
32 struct CBlockLocator;
33 struct WalletContext;
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,
52 };
53 
54 namespace DBKeys {
55 extern const std::string ACENTRY;
56 extern const std::string ACTIVEEXTERNALSPK;
57 extern const std::string ACTIVEINTERNALSPK;
58 extern const std::string BESTBLOCK;
59 extern const std::string BESTBLOCK_NOMERKLE;
60 extern const std::string CRYPTED_KEY;
61 extern const std::string CSCRIPT;
62 extern const std::string DEFAULTKEY;
63 extern const std::string DESTDATA;
64 extern const std::string FLAGS;
65 extern const std::string HDCHAIN;
66 extern const std::string KEY;
67 extern const std::string KEYMETA;
68 extern const std::string LOCKED_UTXO;
69 extern const std::string MASTER_KEY;
70 extern const std::string MINVERSION;
71 extern const std::string NAME;
72 extern const std::string OLD_KEY;
73 extern const std::string ORDERPOSNEXT;
74 extern const std::string POOL;
75 extern const std::string PURPOSE;
76 extern const std::string SETTINGS;
77 extern const std::string TX;
78 extern const std::string VERSION;
79 extern const std::string WALLETDESCRIPTOR;
80 extern const std::string WALLETDESCRIPTORCKEY;
81 extern const std::string WALLETDESCRIPTORKEY;
82 extern const std::string WATCHMETA;
83 extern const std::string WATCHS;
84 } // namespace DBKeys
85 
86 /* simple HD chain data model */
87 class CHDChain
88 {
89 public:
93 
94  static const int VERSION_HD_BASE = 1;
95  static const int VERSION_HD_CHAIN_SPLIT = 2;
97  int nVersion;
98 
99  CHDChain() { SetNull(); }
100 
102  {
103  READWRITE(obj.nVersion, obj.nExternalChainCounter, obj.seed_id);
104  if (obj.nVersion >= VERSION_HD_CHAIN_SPLIT) {
105  READWRITE(obj.nInternalChainCounter);
106  }
107  }
108 
109  void SetNull()
110  {
114  seed_id.SetNull();
115  }
116 
117  bool operator==(const CHDChain& chain) const
118  {
119  return seed_id == chain.seed_id;
120  }
121 };
122 
124 {
125 public:
126  static const int VERSION_BASIC=1;
127  static const int VERSION_WITH_HDDATA=10;
128  static const int VERSION_WITH_KEY_ORIGIN = 12;
130  int nVersion;
131  int64_t nCreateTime; // 0 means unknown
132  std::string hdKeypath; //optional HD/bip32 keypath. Still used to determine whether a key is a seed. Also kept for backwards compatibility
133  CKeyID hd_seed_id; //id of the HD seed used to derive this key
134  KeyOriginInfo key_origin; // Key origin info with path and fingerprint
135  bool has_key_origin = false;
136 
138  {
139  SetNull();
140  }
141  explicit CKeyMetadata(int64_t nCreateTime_)
142  {
143  SetNull();
144  nCreateTime = nCreateTime_;
145  }
146 
148  {
149  READWRITE(obj.nVersion, obj.nCreateTime);
150  if (obj.nVersion >= VERSION_WITH_HDDATA) {
151  READWRITE(obj.hdKeypath, obj.hd_seed_id);
152  }
153  if (obj.nVersion >= VERSION_WITH_KEY_ORIGIN)
154  {
155  READWRITE(obj.key_origin);
156  READWRITE(obj.has_key_origin);
157  }
158  }
159 
160  void SetNull()
161  {
163  nCreateTime = 0;
164  hdKeypath.clear();
166  key_origin.clear();
167  has_key_origin = false;
168  }
169 };
170 
179 {
180 private:
181  template <typename K, typename T>
182  bool WriteIC(const K& key, const T& value, bool fOverwrite = true)
183  {
184  if (!m_batch->Write(key, value, fOverwrite)) {
185  return false;
186  }
188  if (m_database.nUpdateCounter % 1000 == 0) {
189  m_batch->Flush();
190  }
191  return true;
192  }
193 
194  template <typename K>
195  bool EraseIC(const K& key)
196  {
197  if (!m_batch->Erase(key)) {
198  return false;
199  }
201  if (m_database.nUpdateCounter % 1000 == 0) {
202  m_batch->Flush();
203  }
204  return true;
205  }
206 
207 public:
208  explicit WalletBatch(WalletDatabase &database, bool _fFlushOnClose = true) :
209  m_batch(database.MakeBatch(_fFlushOnClose)),
210  m_database(database)
211  {
212  }
213  WalletBatch(const WalletBatch&) = delete;
214  WalletBatch& operator=(const WalletBatch&) = delete;
215 
216  bool WriteName(const std::string& strAddress, const std::string& strName);
217  bool EraseName(const std::string& strAddress);
218 
219  bool WritePurpose(const std::string& strAddress, const std::string& purpose);
220  bool ErasePurpose(const std::string& strAddress);
221 
222  bool WriteTx(const CWalletTx& wtx);
223  bool EraseTx(uint256 hash);
224 
225  bool WriteKeyMetadata(const CKeyMetadata& meta, const CPubKey& pubkey, const bool overwrite);
226  bool WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata &keyMeta);
227  bool WriteCryptedKey(const CPubKey& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, const CKeyMetadata &keyMeta);
228  bool WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey);
229 
230  bool WriteCScript(const uint160& hash, const CScript& redeemScript);
231 
232  bool WriteWatchOnly(const CScript &script, const CKeyMetadata &keymeta);
233  bool EraseWatchOnly(const CScript &script);
234 
235  bool WriteBestBlock(const CBlockLocator& locator);
236  bool ReadBestBlock(CBlockLocator& locator);
237 
238  bool WriteOrderPosNext(int64_t nOrderPosNext);
239 
240  bool ReadPool(int64_t nPool, CKeyPool& keypool);
241  bool WritePool(int64_t nPool, const CKeyPool& keypool);
242  bool ErasePool(int64_t nPool);
243 
244  bool WriteMinVersion(int nVersion);
245 
246  bool WriteDescriptorKey(const uint256& desc_id, const CPubKey& pubkey, const CPrivKey& privkey);
247  bool WriteCryptedDescriptorKey(const uint256& desc_id, const CPubKey& pubkey, const std::vector<unsigned char>& secret);
248  bool WriteDescriptor(const uint256& desc_id, const WalletDescriptor& descriptor);
249  bool WriteDescriptorDerivedCache(const CExtPubKey& xpub, const uint256& desc_id, uint32_t key_exp_index, uint32_t der_index);
250  bool WriteDescriptorParentCache(const CExtPubKey& xpub, const uint256& desc_id, uint32_t key_exp_index);
251  bool WriteDescriptorLastHardenedCache(const CExtPubKey& xpub, const uint256& desc_id, uint32_t key_exp_index);
252  bool WriteDescriptorCacheItems(const uint256& desc_id, const DescriptorCache& cache);
253 
254  bool WriteLockedUTXO(const COutPoint& output);
255  bool EraseLockedUTXO(const COutPoint& output);
256 
258  bool WriteDestData(const std::string &address, const std::string &key, const std::string &value);
260  bool EraseDestData(const std::string &address, const std::string &key);
261 
262  bool WriteActiveScriptPubKeyMan(uint8_t type, const uint256& id, bool internal);
263  bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal);
264 
265  DBErrors LoadWallet(CWallet* pwallet);
266  DBErrors FindWalletTx(std::vector<uint256>& vTxHash, std::list<CWalletTx>& vWtx);
267  DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
268  /* Function to determine if a certain KV/key-type is a key (cryptographical key) type */
269  static bool IsKeyType(const std::string& strType);
270 
272  bool WriteHDChain(const CHDChain& chain);
273 
274  bool WriteWalletFlags(const uint64_t flags);
276  bool TxnBegin();
278  bool TxnCommit();
280  bool TxnAbort();
281 private:
282  std::unique_ptr<DatabaseBatch> m_batch;
284 };
285 
287 void MaybeCompactWalletDB(WalletContext& context);
288 
290 using KeyFilterFn = std::function<bool(const std::string&)>;
291 
293 bool ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, std::string& strType, std::string& strErr, const KeyFilterFn& filter_fn = nullptr);
294 
296 std::unique_ptr<WalletDatabase> CreateDummyWalletDatabase();
297 
299 std::unique_ptr<WalletDatabase> CreateMockWalletDatabase();
300 
301 #endif // BITCOIN_WALLET_WALLETDB_H
WalletBatch::WritePool
bool WritePool(int64_t nPool, const CKeyPool &keypool)
Definition: walletdb.cpp:193
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:1067
CKeyMetadata::VERSION_BASIC
static const int VERSION_BASIC
Definition: walletdb.h:126
WalletBatch::WriteDescriptor
bool WriteDescriptor(const uint256 &desc_id, const WalletDescriptor &descriptor)
Definition: walletdb.cpp:240
DBErrors::NEED_RESCAN
@ NEED_RESCAN
WalletBatch::IsKeyType
static bool IsKeyType(const std::string &strType)
Definition: walletdb.cpp:755
CHDChain::nExternalChainCounter
uint32_t nExternalChainCounter
Definition: walletdb.h:90
DBKeys::OLD_KEY
const std::string OLD_KEY
Definition: walletdb.cpp:47
WalletBatch::WriteCScript
bool WriteCScript(const uint160 &hash, const CScript &redeemScript)
Definition: walletdb.cpp:150
WalletBatch::WriteCryptedDescriptorKey
bool WriteCryptedDescriptorKey(const uint256 &desc_id, const CPubKey &pubkey, const std::vector< unsigned char > &secret)
Definition: walletdb.cpp:231
DBKeys::CSCRIPT
const std::string CSCRIPT
Definition: walletdb.cpp:36
WalletBatch::m_batch
std::unique_ptr< DatabaseBatch > m_batch
Definition: walletdb.h:282
WalletBatch::WriteName
bool WriteName(const std::string &strAddress, const std::string &strName)
Definition: walletdb.cpp:67
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:30
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:130
DBKeys::MASTER_KEY
const std::string MASTER_KEY
Definition: walletdb.cpp:44
DBErrors::NEED_REWRITE
@ NEED_REWRITE
WalletBatch::EraseTx
bool EraseTx(uint256 hash)
Definition: walletdb.cpp:94
flags
int flags
Definition: bitcoin-tx.cpp:525
DBKeys::ORDERPOSNEXT
const std::string ORDERPOSNEXT
Definition: walletdb.cpp:48
CHDChain::nVersion
int nVersion
Definition: walletdb.h:97
WalletBatch::LoadWallet
DBErrors LoadWallet(CWallet *pwallet)
Definition: walletdb.cpp:761
DBKeys::CRYPTED_KEY
const std::string CRYPTED_KEY
Definition: walletdb.cpp:35
CPrivKey
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
CPrivKey is a serialized private key, with all parameters included (SIZE bytes)
Definition: key.h:23
DBKeys::WATCHS
const std::string WATCHS
Definition: walletdb.cpp:60
base_blob::SetNull
void SetNull()
Definition: uint256.h:39
WalletBatch::WriteMasterKey
bool WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey)
Definition: walletdb.cpp:145
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:132
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:95
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:147
WalletBatch::WalletBatch
WalletBatch(WalletDatabase &database, bool _fFlushOnClose=true)
Definition: walletdb.h:208
DBKeys::VERSION
const std::string VERSION
Definition: walletdb.cpp:53
DBKeys::MINVERSION
const std::string MINVERSION
Definition: walletdb.cpp:45
db.h
WalletBatch::WriteActiveScriptPubKeyMan
bool WriteActiveScriptPubKeyMan(uint8_t type, const uint256 &id, bool internal)
Definition: walletdb.cpp:208
DBKeys::ACTIVEINTERNALSPK
const std::string ACTIVEINTERNALSPK
Definition: walletdb.cpp:32
WalletBatch::EraseActiveScriptPubKeyMan
bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal)
Definition: walletdb.cpp:214
WalletBatch::TxnCommit
bool TxnCommit()
Commit current transaction.
Definition: walletdb.cpp:1093
DBKeys::WATCHMETA
const std::string WATCHMETA
Definition: walletdb.cpp:59
WalletBatch::WriteDescriptorParentCache
bool WriteDescriptorParentCache(const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index)
Definition: walletdb.cpp:252
CreateMockWalletDatabase
std::unique_ptr< WalletDatabase > CreateMockWalletDatabase()
Return object for accessing temporary in-memory database.
Definition: walletdb.cpp:1189
DBKeys::WALLETDESCRIPTORCKEY
const std::string WALLETDESCRIPTORCKEY
Definition: walletdb.cpp:57
WalletBatch::m_database
WalletDatabase & m_database
Definition: walletdb.h:283
DBKeys::PURPOSE
const std::string PURPOSE
Definition: walletdb.cpp:50
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:135
WalletBatch::WriteDescriptorLastHardenedCache
bool WriteDescriptorLastHardenedCache(const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index)
Definition: walletdb.cpp:259
CKeyMetadata::VERSION_WITH_KEY_ORIGIN
static const int VERSION_WITH_KEY_ORIGIN
Definition: walletdb.h:128
CHDChain::VERSION_HD_BASE
static const int VERSION_HD_BASE
Definition: walletdb.h:94
DBKeys::KEYMETA
const std::string KEYMETA
Definition: walletdb.cpp:41
WalletBatch::EraseIC
bool EraseIC(const K &key)
Definition: walletdb.h:195
WalletBatch::ReadPool
bool ReadPool(int64_t nPool, CKeyPool &keypool)
Definition: walletdb.cpp:188
WalletBatch::WriteOrderPosNext
bool WriteOrderPosNext(int64_t nOrderPosNext)
Definition: walletdb.cpp:183
WalletBatch::WriteLockedUTXO
bool WriteLockedUTXO(const COutPoint &output)
Definition: walletdb.cpp:288
WalletBatch::EraseDestData
bool EraseDestData(const std::string &address, const std::string &key)
Erase destination data tuple from wallet database.
Definition: walletdb.cpp:1072
DBKeys::POOL
const std::string POOL
Definition: walletdb.cpp:49
DBKeys::WALLETDESCRIPTOR
const std::string WALLETDESCRIPTOR
Definition: walletdb.cpp:54
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:79
DBKeys::SETTINGS
const std::string SETTINGS
Definition: walletdb.cpp:51
WalletBatch::EraseWatchOnly
bool EraseWatchOnly(const CScript &script)
Definition: walletdb.cpp:163
CHDChain::nInternalChainCounter
uint32_t nInternalChainCounter
Definition: walletdb.h:91
DBKeys::DEFAULTKEY
const std::string DEFAULTKEY
Definition: walletdb.cpp:37
sign.h
WalletBatch::WriteBestBlock
bool WriteBestBlock(const CBlockLocator &locator)
Definition: walletdb.cpp:171
WalletBatch::ErasePool
bool ErasePool(int64_t nPool)
Definition: walletdb.cpp:198
WalletBatch::WriteDescriptorDerivedCache
bool WriteDescriptorDerivedCache(const CExtPubKey &xpub, const uint256 &desc_id, uint32_t key_exp_index, uint32_t der_index)
Definition: walletdb.cpp:245
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:72
DBKeys
Definition: walletdb.cpp:29
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:405
WalletBatch::WriteHDChain
bool WriteHDChain(const CHDChain &chain)
write the hdchain model (external chain child index counter)
Definition: walletdb.cpp:1078
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:748
DescriptorCache
Cache for single descriptor's derived extended pubkeys.
Definition: descriptor.h:19
WalletBatch::EraseLockedUTXO
bool EraseLockedUTXO(const COutPoint &output)
Definition: walletdb.cpp:293
CKeyMetadata::CKeyMetadata
CKeyMetadata()
Definition: walletdb.h:137
WalletBatch::ReadBestBlock
bool ReadBestBlock(CBlockLocator &locator)
Definition: walletdb.cpp:177
WalletBatch::WriteDescriptorKey
bool WriteDescriptorKey(const uint256 &desc_id, const CPubKey &pubkey, const CPrivKey &privkey)
Definition: walletdb.cpp:220
key.h
CHDChain::operator==
bool operator==(const CHDChain &chain) const
Definition: walletdb.h:117
CKeyMetadata::hd_seed_id
CKeyID hd_seed_id
Definition: walletdb.h:133
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:119
CreateDummyWalletDatabase
std::unique_ptr< WalletDatabase > CreateDummyWalletDatabase()
Return object for accessing dummy database with no read/write capabilities.
Definition: walletdb.cpp:1183
CHDChain::SetNull
void SetNull()
Definition: walletdb.h:109
CHDChain
Definition: walletdb.h:87
CWallet
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:228
CHDChain::seed_id
CKeyID seed_id
seed hash160
Definition: walletdb.h:92
CWalletTx
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:46
WalletBatch::FindWalletTx
DBErrors FindWalletTx(std::vector< uint256 > &vTxHash, std::list< CWalletTx > &vWtx)
Definition: walletdb.cpp:951
DBErrors::CORRUPT
@ CORRUPT
WalletBatch::WriteKeyMetadata
bool WriteKeyMetadata(const CKeyMetadata &meta, const CPubKey &pubkey, const bool overwrite)
Definition: walletdb.cpp:99
CKeyMetadata::VERSION_WITH_HDDATA
static const int VERSION_WITH_HDDATA
Definition: walletdb.h:127
CKeyMetadata::CKeyMetadata
CKeyMetadata(int64_t nCreateTime_)
Definition: walletdb.h:141
CHDChain::CURRENT_VERSION
static const int CURRENT_VERSION
Definition: walletdb.h:96
WalletBatch::WriteWatchOnly
bool WriteWatchOnly(const CScript &script, const CKeyMetadata &keymeta)
Definition: walletdb.cpp:155
MaybeCompactWalletDB
void MaybeCompactWalletDB(WalletContext &context)
Compacts BDB state so that wallet.dat is self-contained (if there are changes)
Definition: walletdb.cpp:1040
CDataStream
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:204
CKeyMetadata::key_origin
KeyOriginInfo key_origin
Definition: walletdb.h:134
CKeyMetadata::nCreateTime
int64_t nCreateTime
Definition: walletdb.h:131
WalletBatch::WriteIC
bool WriteIC(const K &key, const T &value, bool fOverwrite=true)
Definition: walletdb.h:182
WalletBatch::WriteDescriptorCacheItems
bool WriteDescriptorCacheItems(const uint256 &desc_id, const DescriptorCache &cache)
Definition: walletdb.cpp:266
WalletBatch::ErasePurpose
bool ErasePurpose(const std::string &strAddress)
Definition: walletdb.cpp:84
WalletBatch::ZapSelectTx
DBErrors ZapSelectTx(std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut)
Definition: walletdb.cpp:1002
WalletBatch::WriteMinVersion
bool WriteMinVersion(int nVersion)
Definition: walletdb.cpp:203
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:290
COutPoint
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
CHDChain::SERIALIZE_METHODS
SERIALIZE_METHODS(CHDChain, obj)
Definition: walletdb.h:101
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:1088
WalletBatch::WriteTx
bool WriteTx(const CWalletTx &wtx)
Definition: walletdb.cpp:89
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:129
T
#define T(expected, seed, data)
WalletBatch::WriteKey
bool WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, const CKeyMetadata &keyMeta)
Definition: walletdb.cpp:104
WalletBatch
Access to the wallet database.
Definition: walletdb.h:178
DBKeys::TX
const std::string TX
Definition: walletdb.cpp:52
DBKeys::NAME
const std::string NAME
Definition: walletdb.cpp:46
WalletContext
WalletContext struct containing references to state shared between CWallet instances,...
Definition: context.h:34
CExtPubKey
Definition: pubkey.h:287
CKeyMetadata
Definition: walletdb.h:123
CKeyMetadata::SetNull
void SetNull()
Definition: walletdb.h:160
KeyOriginInfo
Definition: keyorigin.h:11
DBErrors::TOO_NEW
@ TOO_NEW
DBKeys::WALLETDESCRIPTORKEY
const std::string WALLETDESCRIPTORKEY
Definition: walletdb.cpp:58
DBKeys::LOCKED_UTXO
const std::string LOCKED_UTXO
Definition: walletdb.cpp:43
DBErrors::LOAD_FAIL
@ LOAD_FAIL
WalletBatch::WriteWalletFlags
bool WriteWalletFlags(const uint64_t flags)
Definition: walletdb.cpp:1083
CHDChain::CHDChain
CHDChain()
Definition: walletdb.h:99
WalletBatch::TxnAbort
bool TxnAbort()
Abort current transaction.
Definition: walletdb.cpp:1098
DBKeys::DESTDATA
const std::string DESTDATA
Definition: walletdb.cpp:38