7 #ifndef RAVEN_WALLET_WALLETDB_H 8 #define RAVEN_WALLET_WALLETDB_H 36 static const bool DEFAULT_FLUSHWALLET =
true;
75 template <
typename Stream,
typename Operation>
81 if (this->nVersion >= VERSION_HD_CHAIN_SPLIT)
88 nExternalChainCounter = 0;
89 nInternalChainCounter = 0;
97 static const int VERSION_BASIC=1;
98 static const int VERSION_WITH_HDDATA=10;
112 nCreateTime = nCreateTime_;
117 template <
typename Stream,
typename Operation>
121 if (this->nVersion >= VERSION_WITH_HDDATA)
145 template <
typename K,
typename T>
146 bool WriteIC(
const K& key,
const T& value,
bool fOverwrite =
true)
148 if (!batch.Write(key, value, fOverwrite)) {
151 m_dbw.IncrementUpdateCounter();
155 template <
typename K>
158 if (!batch.Erase(key)) {
161 m_dbw.IncrementUpdateCounter();
167 batch(dbw, pszMode, _fFlushOnClose),
174 bool WriteName(
const std::string& strAddress,
const std::string& strName);
175 bool EraseName(
const std::string& strAddress);
177 bool WritePurpose(
const std::string& strAddress,
const std::string& purpose);
178 bool ErasePurpose(
const std::string& strAddress);
184 bool WriteCryptedKey(
const CPubKey& vchPubKey,
const std::vector<unsigned char>& vchCryptedSecret,
const CKeyMetadata &keyMeta);
185 bool WriteMasterKey(
unsigned int nID,
const CMasterKey& kMasterKey);
187 bool WriteCScript(
const uint160& hash,
const CScript& redeemScript);
190 bool EraseWatchOnly(
const CScript &script);
195 bool WriteOrderPosNext(int64_t nOrderPosNext);
197 bool ReadPool(int64_t nPool,
CKeyPool& keypool);
198 bool WritePool(int64_t nPool,
const CKeyPool& keypool);
199 bool ErasePool(int64_t nPool);
205 bool WriteAccountingEntry(
const uint64_t nAccEntryNum,
const CAccountingEntry& acentry);
206 bool ReadAccount(
const std::string& strAccount,
CAccount& account);
207 bool WriteAccount(
const std::string& strAccount,
const CAccount& account);
210 bool WriteDestData(
const std::string &address,
const std::string &key,
const std::string &value);
212 bool EraseDestData(
const std::string &address,
const std::string &key);
214 CAmount GetAccountCreditDebit(
const std::string& strAccount);
215 void ListAccountCreditDebit(
const std::string& strAccount, std::list<CAccountingEntry>& acentries);
218 DBErrors FindWalletTx(std::vector<uint256>& vTxHash, std::vector<CWalletTx>& vWtx);
219 DBErrors ZapWalletTx(std::vector<CWalletTx>& vWtx);
220 DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
222 static bool Recover(
const std::string& filename,
void *callbackDataIn,
bool (*recoverKVcallback)(
void* callbackData,
CDataStream ssKey,
CDataStream ssValue), std::string& out_backup_filename);
224 static bool Recover(
const std::string& filename, std::string& out_backup_filename);
228 static bool IsKeyType(
const std::string& strType);
230 static bool VerifyEnvironment(
const std::string& walletFile,
const fs::path& dataDir, std::string& errorStr);
232 static bool VerifyDatabaseFile(
const std::string& walletFile,
const fs::path& dataDir, std::string& warningStr, std::string& errorStr);
235 bool WriteHDChain(
const CHDChain& chain);
244 bool ReadVersion(
int& nVersion);
246 bool WriteVersion(
int nVersion);
255 #endif // RAVEN_WALLET_WALLETDB_H static const int CURRENT_VERSION
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
bool WriteIC(const K &key, const T &value, bool fOverwrite=true)
Private key encryption is done based on a CMasterKey, which holds a salt and random encryption key...
bool EraseIC(const K &key)
uint32_t nExternalChainCounter
Double ended buffer combining vector and stream-like interfaces.
DBErrors
Error statuses for the wallet database.
void SerializationOp(Stream &s, Operation ser_action)
int64_t CAmount
Amount in corbies (Can be negative)
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
secp256k1: const unsigned int PRIVATE_KEY_SIZE = 279; const unsigned int PUBLIC_KEY_SIZE = 65; const ...
An instance of this class represents one database.
CWalletDB(CWalletDBWrapper &dbw, const char *pszMode="r+", bool _fFlushOnClose=true)
void MaybeCompactWalletDB()
Compacts BDB state so that wallet.dat is self-contained (if there are changes)
An encapsulated public key.
RAII class that provides access to a Berkeley database.
Access to the wallet database.
A transaction with a bunch of additional info that only the owner cares about.
Serialized script, used inside transaction inputs and outputs.
A reference to a CKey: the Hash160 of its serialized public key.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
static const int VERSION_HD_CHAIN_SPLIT
CKeyID seed_id
seed hash160
static const int VERSION_HD_BASE
uint32_t nInternalChainCounter