Bitcoin Core  0.20.99
P2P Digital Currency
dummywallet.cpp
Go to the documentation of this file.
1 // Copyright (c) 2018-2020 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 <util/system.h>
6 #include <walletinitinterface.h>
8 
9 class CWallet;
10 enum class WalletCreationStatus;
11 struct bilingual_str;
12 
13 namespace interfaces {
14 class Chain;
15 class Handler;
16 class Wallet;
17 }
18 
20 public:
21 
22  bool HasWalletSupport() const override {return false;}
23  void AddWalletOptions() const override;
24  bool ParameterInteraction() const override {return true;}
25  void Construct(NodeContext& node) const override {LogPrintf("No wallet support compiled in!\n");}
26 };
27 
29 {
31  "-addresstype",
32  "-avoidpartialspends",
33  "-changetype",
34  "-disablewallet",
35  "-discardfee=<amt>",
36  "-fallbackfee=<amt>",
37  "-keypool=<n>",
38  "-maxtxfee=<amt>",
39  "-mintxfee=<amt>",
40  "-paytxfee=<amt>",
41  "-rescan",
42  "-salvagewallet",
43  "-spendzeroconfchange",
44  "-txconfirmtarget=<n>",
45  "-upgradewallet",
46  "-wallet=<path>",
47  "-walletbroadcast",
48  "-walletdir=<dir>",
49  "-walletnotify=<cmd>",
50  "-walletrbf",
51  "-zapwallettxes=<mode>",
52  "-dblogsize=<n>",
53  "-flushwallet",
54  "-privdb",
55  "-walletrejectlongchains",
56  });
57 }
58 
60 
61 fs::path GetWalletDir()
62 {
63  throw std::logic_error("Wallet function called in non-wallet build.");
64 }
65 
66 std::vector<fs::path> ListWalletDir()
67 {
68  throw std::logic_error("Wallet function called in non-wallet build.");
69 }
70 
71 std::vector<std::shared_ptr<CWallet>> GetWallets()
72 {
73  throw std::logic_error("Wallet function called in non-wallet build.");
74 }
75 
76 std::shared_ptr<CWallet> LoadWallet(interfaces::Chain& chain, const std::string& name, bilingual_str& error, std::vector<bilingual_str>& warnings)
77 {
78  throw std::logic_error("Wallet function called in non-wallet build.");
79 }
80 
81 WalletCreationStatus CreateWallet(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)
82 {
83  throw std::logic_error("Wallet function called in non-wallet build.");
84 }
85 
86 using LoadWalletFn = std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>;
87 std::unique_ptr<interfaces::Handler> HandleLoadWallet(LoadWalletFn load_wallet)
88 {
89  throw std::logic_error("Wallet function called in non-wallet build.");
90 }
91 
92 namespace interfaces {
93 
94 std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet)
95 {
96  throw std::logic_error("Wallet function called in non-wallet build.");
97 }
98 
99 } // namespace interfaces
bool ParameterInteraction() const override
Check wallet parameter interaction.
Definition: dummywallet.cpp:24
std::vector< std::shared_ptr< CWallet > > GetWallets()
Definition: dummywallet.cpp:71
std::shared_ptr< CWallet > LoadWallet(interfaces::Chain &chain, const std::string &name, bilingual_str &error, std::vector< bilingual_str > &warnings)
Definition: dummywallet.cpp:76
Bilingual messages:
Definition: translation.h:16
bool HasWalletSupport() const override
Is the wallet component enabled.
Definition: dummywallet.cpp:22
void AddHiddenArgs(const std::vector< std::string > &args)
Add many hidden arguments.
Definition: system.cpp:439
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:60
static void LogPrintf(const char *fmt, const Args &... args)
Definition: logging.h:166
void AddWalletOptions() const override
Get wallet help string.
Definition: dummywallet.cpp:28
WalletCreationStatus
Definition: wallet.h:60
std::vector< fs::path > ListWalletDir()
Get wallets in wallet directory.
Definition: dummywallet.cpp:66
void Construct(NodeContext &node) const override
Add wallets that should be opened to list of chain clients.
Definition: dummywallet.cpp:25
NodeContext struct containing references to chain state and connection state.
Definition: context.h:34
const char * name
Definition: rest.cpp:41
Interface for accessing a wallet.
Definition: wallet.h:50
WalletCreationStatus CreateWallet(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:81
std::function< void(std::unique_ptr< interfaces::Wallet > wallet)> LoadWalletFn
Definition: dummywallet.cpp:86
std::unique_ptr< Wallet > MakeWallet(const std::shared_ptr< CWallet > &wallet)
Return implementation of Wallet interface.
Definition: dummywallet.cpp:94
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:59
std::unique_ptr< interfaces::Handler > HandleLoadWallet(LoadWalletFn load_wallet)
Definition: dummywallet.cpp:87
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:80
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:622
ArgsManager gArgs
Definition: system.cpp:77
fs::path GetWalletDir()
Get the path of the wallet directory.
Definition: dummywallet.cpp:61
bool error(const char *fmt, const Args &... args)
Definition: system.h:49