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