Bitcoin ABC  0.22.12
P2P Digital Currency
dummywallet.cpp
Go to the documentation of this file.
1 // Copyright (c) 2018 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <logging.h>
7 #include <util/system.h>
8 #include <walletinitinterface.h>
9 
10 class CChainParams;
11 class CWallet;
12 enum class WalletCreationStatus;
13 struct bilingual_str;
14 
15 namespace interfaces {
16 class Chain;
17 class Handler;
18 class Wallet;
19 } // namespace interfaces
20 
22 public:
23  bool HasWalletSupport() const override { return false; }
24  void AddWalletOptions(ArgsManager &argsman) const override;
25  bool ParameterInteraction() const override { return true; }
26  void Construct(NodeContext &node) const override {
27  LogPrintf("No wallet support compiled in!\n");
28  }
29 };
30 
32  std::vector<std::string> opts = {
33  "-avoidpartialspends", "-disablewallet", "-fallbackfee=<amt>",
34  "-keypool=<n>", "-maxapsfee=<n>", "-maxtxfee=<amt>", "-mintxfee=<amt>",
35  "-paytxfee=<amt>", "-rescan", "-salvagewallet", "-spendzeroconfchange",
36  "-upgradewallet", "-wallet=<path>", "-walletbroadcast",
37  "-walletdir=<dir>", "-walletnotify=<cmd>", "-zapwallettxes=<mode>",
38  // Wallet debug options
39  "-dblogsize=<n>", "-flushwallet", "-privdb", "-walletrejectlongchains"};
40  argsman.AddHiddenArgs(opts);
41 }
42 
44 
45 fs::path GetWalletDir() {
46  throw std::logic_error("Wallet function called in non-wallet build.");
47 }
48 
49 std::vector<fs::path> ListWalletDir() {
50  throw std::logic_error("Wallet function called in non-wallet build.");
51 }
52 
53 std::vector<std::shared_ptr<CWallet>> GetWallets() {
54  throw std::logic_error("Wallet function called in non-wallet build.");
55 }
56 
57 std::shared_ptr<CWallet> LoadWallet(const CChainParams &chainParams,
58  interfaces::Chain &chain,
59  const std::string &name,
61  std::vector<bilingual_str> &warnings) {
62  throw std::logic_error("Wallet function called in non-wallet build.");
63 }
64 
66  interfaces::Chain &chain,
67  const SecureString &passphrase,
68  uint64_t wallet_creation_flags,
69  const std::string &name, bilingual_str &error,
70  std::vector<bilingual_str> &warnings,
71  std::shared_ptr<CWallet> &result) {
72  throw std::logic_error("Wallet function called in non-wallet build.");
73 }
74 
75 using LoadWalletFn =
76  std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>;
77 std::unique_ptr<interfaces::Handler>
79  throw std::logic_error("Wallet function called in non-wallet build.");
80 }
81 
82 namespace interfaces {
83 
84 std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet> &wallet) {
85  throw std::logic_error("Wallet function called in non-wallet build.");
86 }
87 
88 } // namespace interfaces
WalletCreationStatus CreateWallet(const CChainParams &chainParams, interfaces::Chain &chain, const SecureString &passphrase, uint64_t wallet_creation_flags, const std::string &name, bilingual_str &error, std::vector< bilingual_str > &warnings, std::shared_ptr< CWallet > &result)
Definition: dummywallet.cpp:65
bool ParameterInteraction() const override
Check wallet parameter interaction.
Definition: dummywallet.cpp:25
std::vector< std::shared_ptr< CWallet > > GetWallets()
Definition: dummywallet.cpp:53
Bilingual messages:
Definition: translation.h:17
std::shared_ptr< CWallet > LoadWallet(const CChainParams &chainParams, interfaces::Chain &chain, const std::string &name, bilingual_str &error, std::vector< bilingual_str > &warnings)
Definition: dummywallet.cpp:57
bool HasWalletSupport() const override
Is the wallet component enabled.
Definition: dummywallet.cpp:23
void AddHiddenArgs(const std::vector< std::string > &args)
Add many hidden arguments.
Definition: system.cpp:568
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:56
static void LogPrintf(const char *fmt, const Args &... args)
Definition: logging.h:171
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
Definition: chainparams.h:47
WalletCreationStatus
Definition: wallet.h:68
std::vector< fs::path > ListWalletDir()
Get wallets in wallet directory.
Definition: dummywallet.cpp:49
void Construct(NodeContext &node) const override
Add wallets that should be opened to list of chain clients.
Definition: dummywallet.cpp:26
NodeContext struct containing references to chain state and connection state.
Definition: context.h:35
const char * name
Definition: rest.cpp:43
Interface for accessing a wallet.
Definition: wallet.h:56
std::function< void(std::unique_ptr< interfaces::Wallet > wallet)> LoadWalletFn
Definition: dummywallet.cpp:76
std::unique_ptr< Wallet > MakeWallet(const std::shared_ptr< CWallet > &wallet)
Return implementation of Wallet interface.
Definition: dummywallet.cpp:84
Generic interface for managing an event handler or callback function registered with another interfac...
Definition: handler.h:22
const WalletInitInterface & g_wallet_init_interface
Definition: dummywallet.cpp:43
std::unique_ptr< interfaces::Handler > HandleLoadWallet(LoadWalletFn load_wallet)
Definition: dummywallet.cpp:78
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:105
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:679
fs::path GetWalletDir()
Get the path of the wallet directory.
Definition: dummywallet.cpp:45
bool error(const char *fmt, const Args &... args)
Definition: system.h:47
void AddWalletOptions(ArgsManager &argsman) const override
Get wallet help string.
Definition: dummywallet.cpp:31