6 #ifndef FABCOIN_WALLET_WALLETDB_H 7 #define FABCOIN_WALLET_WALLETDB_H 35 static const bool DEFAULT_FLUSHWALLET =
true;
76 template <
typename Stream,
typename Operation>
82 if (this->nVersion >= VERSION_HD_CHAIN_SPLIT)
89 nExternalChainCounter = 0;
90 nInternalChainCounter = 0;
98 static const int VERSION_BASIC=1;
99 static const int VERSION_WITH_HDDATA=10;
113 nCreateTime = nCreateTime_;
118 template <
typename Stream,
typename Operation>
122 if (this->nVersion >= VERSION_WITH_HDDATA)
146 template <
typename K,
typename T>
147 bool WriteIC(
const K& key,
const T& value,
bool fOverwrite =
true)
149 if (!batch.Write(key, value, fOverwrite)) {
152 m_dbw.IncrementUpdateCounter();
156 template <
typename K>
159 if (!batch.Erase(key)) {
162 m_dbw.IncrementUpdateCounter();
168 batch(dbw, pszMode, _fFlushOnClose),
173 bool WriteName(
const std::string& strAddress,
const std::string& strName);
174 bool EraseName(
const std::string& strAddress);
176 bool WritePurpose(
const std::string& strAddress,
const std::string& purpose);
177 bool ErasePurpose(
const std::string& strAddress);
185 bool WriteTokenTx(
const CTokenTx& wTokenTx);
186 bool EraseTokenTx(
uint256 hash);
189 bool WriteCryptedKey(
const CPubKey& vchPubKey,
const std::vector<unsigned char>& vchCryptedSecret,
const CKeyMetadata &keyMeta);
190 bool WriteMasterKey(
unsigned int nID,
const CMasterKey& kMasterKey);
192 bool WriteCScript(
const uint160& hash,
const CScript& redeemScript);
195 bool EraseWatchOnly(
const CScript &script);
200 bool WriteOrderPosNext(int64_t nOrderPosNext);
202 bool WriteDefaultKey(
const CPubKey& vchPubKey);
204 bool ReadPool(int64_t nPool,
CKeyPool& keypool);
205 bool WritePool(int64_t nPool,
const CKeyPool& keypool);
206 bool ErasePool(int64_t nPool);
212 bool WriteAccountingEntry(
const uint64_t nAccEntryNum,
const CAccountingEntry& acentry);
213 bool ReadAccount(
const std::string& strAccount,
CAccount& account);
214 bool WriteAccount(
const std::string& strAccount,
const CAccount& account);
217 bool WriteDestData(
const std::string &
address,
const std::string &key,
const std::string &value);
219 bool EraseDestData(
const std::string &address,
const std::string &key);
222 bool WriteContractData(
const std::string &address,
const std::string &key,
const std::string &value);
224 bool EraseContractData(
const std::string &address,
const std::string &key);
227 CAmount GetAccountCreditDebit(
const std::string& strAccount);
228 void ListAccountCreditDebit(
const std::string& strAccount, std::list<CAccountingEntry>& acentries);
231 DBErrors FindWalletTx(std::vector<uint256>& vTxHash, std::vector<CWalletTx>& vWtx);
232 DBErrors ZapWalletTx(std::vector<CWalletTx>& vWtx);
233 DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
235 static bool Recover(
const std::string& filename,
void *callbackDataIn,
bool (*recoverKVcallback)(
void* callbackData,
CDataStream ssKey,
CDataStream ssValue), std::string& out_backup_filename);
237 static bool Recover(
const std::string& filename, std::string& out_backup_filename);
241 static bool IsKeyType(
const std::string& strType);
243 static bool VerifyEnvironment(
const std::string& walletFile,
const fs::path& dataDir, std::string& errorStr);
245 static bool VerifyDatabaseFile(
const std::string& walletFile,
const fs::path& dataDir, std::string& warningStr, std::string& errorStr);
248 bool WriteHDChain(
const CHDChain& chain);
257 bool ReadVersion(
int& nVersion);
259 bool WriteVersion(
int nVersion);
271 #endif // FABCOIN_WALLET_WALLETDB_H static const int CURRENT_VERSION
CKeyID masterKeyID
master key hash160
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 lius (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
struct evm_uint160be address(struct evm_env *env)
static const int VERSION_HD_BASE
uint32_t nInternalChainCounter