Bitcoin ABC 0.30.7
P2P Digital Currency
Classes | Enumerations | Functions | Variables
backup.cpp File Reference
#include <wallet/rpc/backup.h>
#include <chain.h>
#include <common/args.h>
#include <config.h>
#include <core_io.h>
#include <interfaces/chain.h>
#include <key_io.h>
#include <merkleblock.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/standard.h>
#include <sync.h>
#include <util/bip32.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/time.h>
#include <util/translation.h>
#include <wallet/rpc/util.h>
#include <wallet/rpcwallet.h>
#include <wallet/spend.h>
#include <wallet/wallet.h>
#include <algorithm>
#include <cstdint>
#include <fstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
Include dependency graph for backup.cpp:

Go to the source code of this file.

Classes

struct  ImportData
 

Enumerations

enum class  ScriptContext { TOP , P2SH }
 

Functions

static std::string EncodeDumpString (const std::string &str)
 
static std::string DecodeDumpString (const std::string &str)
 
static bool GetWalletAddressesForKey (const Config &config, LegacyScriptPubKeyMan *spk_man, const CWallet *const pwallet, const CKeyID &keyid, std::string &strAddr, std::string &strLabel) EXCLUSIVE_LOCKS_REQUIRED(pwallet -> cs_wallet)
 
static void RescanWallet (CWallet &wallet, const WalletRescanReserver &reserver, int64_t time_begin=TIMESTAMP_MIN, bool update=true)
 
RPCHelpMan importprivkey ()
 
RPCHelpMan abortrescan ()
 
RPCHelpMan importaddress ()
 
RPCHelpMan importprunedfunds ()
 
RPCHelpMan removeprunedfunds ()
 
RPCHelpMan importpubkey ()
 
RPCHelpMan importwallet ()
 
RPCHelpMan dumpprivkey ()
 
RPCHelpMan dumpwallet ()
 
static RPCHelpMan dumpcoins ()
 
static std::string RecurseImportData (const CScript &script, ImportData &import_data, const ScriptContext script_ctx)
 
static UniValue ProcessImportLegacy (CWallet *const pwallet, ImportData &import_data, std::map< CKeyID, CPubKey > &pubkey_map, std::map< CKeyID, CKey > &privkey_map, std::set< CScript > &script_pub_keys, bool &have_solving_data, const UniValue &data, std::vector< CKeyID > &ordered_pubkeys)
 
static UniValue ProcessImportDescriptor (ImportData &import_data, std::map< CKeyID, CPubKey > &pubkey_map, std::map< CKeyID, CKey > &privkey_map, std::set< CScript > &script_pub_keys, bool &have_solving_data, const UniValue &data, std::vector< CKeyID > &ordered_pubkeys)
 
static UniValue ProcessImport (CWallet *const pwallet, const UniValue &data, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(pwallet -> cs_wallet)
 
static int64_t GetImportTimestamp (const UniValue &data, int64_t now)
 
static std::string GetRescanErrorMessage (const std::string &object, const int64_t objectTimestamp, const int64_t blockTimestamp)
 
RPCHelpMan importmulti ()
 
static UniValue ProcessDescriptorImport (CWallet *const pwallet, const UniValue &data, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(pwallet -> cs_wallet)
 
RPCHelpMan importdescriptors ()
 
RPCHelpMan backupwallet ()
 
RPCHelpMan restorewallet ()
 
Span< const CRPCCommandGetWalletDumpRPCCommands ()
 

Variables

static const int64_t TIMESTAMP_MIN = 0
 

Enumeration Type Documentation

◆ ScriptContext

enum class ScriptContext
strong
Enumerator
TOP 

Top-level scriptPubKey.

P2SH 

P2SH redeemScript.

Definition at line 1177 of file backup.cpp.

Function Documentation

◆ abortrescan()

RPCHelpMan abortrescan ( )

Definition at line 235 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ backupwallet()

RPCHelpMan backupwallet ( )

Definition at line 2356 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DecodeDumpString()

static std::string DecodeDumpString ( const std::string &  str)
static

Definition at line 52 of file backup.cpp.

Here is the caller graph for this function:

◆ dumpcoins()

static RPCHelpMan dumpcoins ( )
static

Definition at line 1094 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpprivkey()

RPCHelpMan dumpprivkey ( )

Definition at line 862 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpwallet()

RPCHelpMan dumpwallet ( )

Prevent arbitrary files from being overwritten. There have been reports that users have overwritten wallet files this way: https://github.com/bitcoin/bitcoin/issues/9934 It may also avoid other security issues.

Definition at line 915 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EncodeDumpString()

static std::string EncodeDumpString ( const std::string &  str)
static

Definition at line 40 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetImportTimestamp()

static int64_t GetImportTimestamp ( const UniValue data,
int64_t  now 
)
static

Definition at line 1649 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRescanErrorMessage()

static std::string GetRescanErrorMessage ( const std::string &  object,
const int64_t  objectTimestamp,
const int64_t  blockTimestamp 
)
static

Definition at line 1666 of file backup.cpp.

Here is the caller graph for this function:

◆ GetWalletAddressesForKey()

static bool GetWalletAddressesForKey ( const Config config,
LegacyScriptPubKeyMan spk_man,
const CWallet *const  pwallet,
const CKeyID keyid,
std::string &  strAddr,
std::string &  strLabel 
) -> cs_wallet)
static

Definition at line 67 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetWalletDumpRPCCommands()

Span< const CRPCCommand > GetWalletDumpRPCCommands ( )

Definition at line 2480 of file backup.cpp.

Here is the call graph for this function:

◆ importaddress()

RPCHelpMan importaddress ( )

Definition at line 268 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importdescriptors()

RPCHelpMan importdescriptors ( )

Definition at line 2141 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importmulti()

RPCHelpMan importmulti ( )

Definition at line 1682 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importprivkey()

RPCHelpMan importprivkey ( )

Definition at line 109 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importprunedfunds()

RPCHelpMan importprunedfunds ( )

Definition at line 403 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importpubkey()

RPCHelpMan importpubkey ( )

Definition at line 536 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importwallet()

RPCHelpMan importwallet ( )

Definition at line 647 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessDescriptorImport()

static UniValue ProcessDescriptorImport ( CWallet *const  pwallet,
const UniValue data,
const int64_t  timestamp 
) -> cs_wallet)
static

Definition at line 1962 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessImport()

static UniValue ProcessImport ( CWallet *const  pwallet,
const UniValue data,
const int64_t  timestamp 
) -> cs_wallet)
static

Definition at line 1540 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessImportDescriptor()

static UniValue ProcessImportDescriptor ( ImportData import_data,
std::map< CKeyID, CPubKey > &  pubkey_map,
std::map< CKeyID, CKey > &  privkey_map,
std::set< CScript > &  script_pub_keys,
bool &  have_solving_data,
const UniValue data,
std::vector< CKeyID > &  ordered_pubkeys 
)
static

Definition at line 1427 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessImportLegacy()

static UniValue ProcessImportLegacy ( CWallet *const  pwallet,
ImportData import_data,
std::map< CKeyID, CPubKey > &  pubkey_map,
std::map< CKeyID, CKey > &  privkey_map,
std::set< CScript > &  script_pub_keys,
bool &  have_solving_data,
const UniValue data,
std::vector< CKeyID > &  ordered_pubkeys 
)
static

Definition at line 1240 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RecurseImportData()

static std::string RecurseImportData ( const CScript script,
ImportData import_data,
const ScriptContext  script_ctx 
)
static

Definition at line 1187 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeprunedfunds()

RPCHelpMan removeprunedfunds ( )

Definition at line 486 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RescanWallet()

static void RescanWallet ( CWallet wallet,
const WalletRescanReserver reserver,
int64_t  time_begin = TIMESTAMP_MIN,
bool  update = true 
)
static

Definition at line 96 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restorewallet()

RPCHelpMan restorewallet ( )

Definition at line 2395 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ TIMESTAMP_MIN

const int64_t TIMESTAMP_MIN = 0
static

Definition at line 94 of file backup.cpp.