Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/walletdb.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Copyright (c) 2017 The Bitcoin developers | |||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_WALLET_WALLETDB_H | #ifndef BITCOIN_WALLET_WALLETDB_H | ||||
#define BITCOIN_WALLET_WALLETDB_H | #define BITCOIN_WALLET_WALLETDB_H | ||||
#include "amount.h" | #include "amount.h" | ||||
#include "key.h" | #include "key.h" | ||||
#include "primitives/transaction.h" | #include "primitives/transaction.h" | ||||
#include "script/standard.h" // for CTxDestination | |||||
#include "wallet/db.h" | #include "wallet/db.h" | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <list> | #include <list> | ||||
#include <string> | #include <string> | ||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
/** Access to the wallet database */ | /** Access to the wallet database */ | ||||
class CWalletDB : public CDB { | class CWalletDB : public CDB { | ||||
public: | public: | ||||
CWalletDB(const std::string &strFilename, const char *pszMode = "r+", | CWalletDB(const std::string &strFilename, const char *pszMode = "r+", | ||||
bool fFlushOnClose = true) | bool fFlushOnClose = true) | ||||
: CDB(strFilename, pszMode, fFlushOnClose) {} | : CDB(strFilename, pszMode, fFlushOnClose) {} | ||||
bool WriteName(const std::string &strAddress, const std::string &strName); | bool WriteName(const CTxDestination &address, const std::string &strName); | ||||
bool EraseName(const std::string &strAddress); | bool EraseName(const CTxDestination &address); | ||||
bool WritePurpose(const std::string &strAddress, | bool WritePurpose(const CTxDestination &address, | ||||
const std::string &purpose); | const std::string &purpose); | ||||
bool ErasePurpose(const std::string &strAddress); | bool ErasePurpose(const CTxDestination &address); | ||||
bool WriteTx(const CWalletTx &wtx); | bool WriteTx(const CWalletTx &wtx); | ||||
bool EraseTx(uint256 hash); | bool EraseTx(uint256 hash); | ||||
bool WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, | bool WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, | ||||
const CKeyMetadata &keyMeta); | const CKeyMetadata &keyMeta); | ||||
bool WriteCryptedKey(const CPubKey &vchPubKey, | bool WriteCryptedKey(const CPubKey &vchPubKey, | ||||
const std::vector<uint8_t> &vchCryptedSecret, | const std::vector<uint8_t> &vchCryptedSecret, | ||||
Show All 23 Lines | public: | ||||
/// Use wallet.AddAccountingEntry instead, to write *and* update its caches. | /// Use wallet.AddAccountingEntry instead, to write *and* update its caches. | ||||
bool WriteAccountingEntry(const uint64_t nAccEntryNum, | bool WriteAccountingEntry(const uint64_t nAccEntryNum, | ||||
const CAccountingEntry &acentry); | const CAccountingEntry &acentry); | ||||
bool WriteAccountingEntry_Backend(const CAccountingEntry &acentry); | bool WriteAccountingEntry_Backend(const CAccountingEntry &acentry); | ||||
bool ReadAccount(const std::string &strAccount, CAccount &account); | bool ReadAccount(const std::string &strAccount, CAccount &account); | ||||
bool WriteAccount(const std::string &strAccount, const CAccount &account); | bool WriteAccount(const std::string &strAccount, const CAccount &account); | ||||
/// Write destination data key,value tuple to database. | /// Write destination data key,value tuple to database. | ||||
bool WriteDestData(const std::string &address, const std::string &key, | bool WriteDestData(const CTxDestination &address, const std::string &key, | ||||
const std::string &value); | const std::string &value); | ||||
/// Erase destination data tuple from wallet database. | /// Erase destination data tuple from wallet database. | ||||
bool EraseDestData(const std::string &address, const std::string &key); | bool EraseDestData(const CTxDestination &address, const std::string &key); | ||||
Amount GetAccountCreditDebit(const std::string &strAccount); | Amount GetAccountCreditDebit(const std::string &strAccount); | ||||
void ListAccountCreditDebit(const std::string &strAccount, | void ListAccountCreditDebit(const std::string &strAccount, | ||||
std::list<CAccountingEntry> &acentries); | std::list<CAccountingEntry> &acentries); | ||||
DBErrors LoadWallet(CWallet *pwallet); | DBErrors LoadWallet(CWallet *pwallet); | ||||
DBErrors FindWalletTx(CWallet *pwallet, std::vector<uint256> &vTxHash, | DBErrors FindWalletTx(CWallet *pwallet, std::vector<uint256> &vTxHash, | ||||
std::vector<CWalletTx> &vWtx); | std::vector<CWalletTx> &vWtx); | ||||
Show All 21 Lines |