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 <stdio.h>
6 #include <util/system.h>
7 #include <walletinitinterface.h>
8
9 class CWallet;
10
11 namespace interfaces {
12 class Chain;
13 }
14
15 class DummyWalletInit : public WalletInitInterface {
16 public:
17
HasWalletSupport() const18 bool HasWalletSupport() const override {return false;}
19 void AddWalletOptions() const override;
ParameterInteraction() const20 bool ParameterInteraction() const override {return true;}
Construct(InitInterfaces & interfaces) const21 void Construct(InitInterfaces& interfaces) const override {LogPrintf("No wallet support compiled in!\n");}
22 };
23
AddWalletOptions() const24 void DummyWalletInit::AddWalletOptions() const
25 {
26 std::vector<std::string> opts = {
27 "-addresstype",
28 "-avoidpartialspends",
29 "-changetype",
30 "-disablewallet",
31 "-discardfee=<amt>",
32 "-fallbackfee=<amt>",
33 "-keypool=<n>",
34 "-mintxfee=<amt>",
35 "-paytxfee=<amt>",
36 "-rescan",
37 "-salvagewallet",
38 "-spendzeroconfchange",
39 "-txconfirmtarget=<n>",
40 "-upgradewallet",
41 "-wallet=<path>",
42 "-walletbroadcast",
43 "-walletdir=<dir>",
44 "-walletnotify=<cmd>",
45 "-walletrbf",
46 "-zapwallettxes=<mode>",
47 "-dblogsize=<n>",
48 "-flushwallet",
49 "-privdb",
50 "-walletrejectlongchains",
51 };
52 gArgs.AddHiddenArgs(opts);
53 }
54
55 const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
56
GetWalletDir()57 fs::path GetWalletDir()
58 {
59 throw std::logic_error("Wallet function called in non-wallet build.");
60 }
61
ListWalletDir()62 std::vector<fs::path> ListWalletDir()
63 {
64 throw std::logic_error("Wallet function called in non-wallet build.");
65 }
66
GetWallets()67 std::vector<std::shared_ptr<CWallet>> GetWallets()
68 {
69 throw std::logic_error("Wallet function called in non-wallet build.");
70 }
71
LoadWallet(interfaces::Chain & chain,const std::string & name,std::string & error,std::string & warning)72 std::shared_ptr<CWallet> LoadWallet(interfaces::Chain& chain, const std::string& name, std::string& error, std::string& warning)
73 {
74 throw std::logic_error("Wallet function called in non-wallet build.");
75 }
76
77 namespace interfaces {
78
79 class Wallet;
80
MakeWallet(const std::shared_ptr<CWallet> & wallet)81 std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet)
82 {
83 throw std::logic_error("Wallet function called in non-wallet build.");
84 }
85
86 } // namespace interfaces
87