File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,16 @@ void DummyWalletInit::AddWalletOptions() const
3434
3535const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
3636
37+ fs::path GetWalletDir ()
38+ {
39+ throw std::logic_error (" Wallet function called in non-wallet build." );
40+ }
41+
42+ std::vector<fs::path> ListWalletDir ()
43+ {
44+ throw std::logic_error (" Wallet function called in non-wallet build." );
45+ }
46+
3747std::vector<std::shared_ptr<CWallet>> GetWallets ()
3848{
3949 throw std::logic_error (" Wallet function called in non-wallet build." );
Original file line number Diff line number Diff line change 3838#include < univalue.h>
3939
4040class CWallet ;
41+ fs::path GetWalletDir ();
42+ std::vector<fs::path> ListWalletDir ();
4143std::vector<std::shared_ptr<CWallet>> GetWallets ();
4244
4345namespace interfaces {
@@ -218,6 +220,18 @@ class NodeImpl : public Node
218220 LOCK (::cs_main);
219221 return ::pcoinsTip->GetCoin (output, coin);
220222 }
223+ std::string getWalletDir () override
224+ {
225+ return GetWalletDir ().string ();
226+ }
227+ std::vector<std::string> listWalletDir () override
228+ {
229+ std::vector<std::string> paths;
230+ for (auto & path : ListWalletDir ()) {
231+ paths.push_back (path.string ());
232+ }
233+ return paths;
234+ }
221235 std::vector<std::unique_ptr<Wallet>> getWallets () override
222236 {
223237 std::vector<std::unique_ptr<Wallet>> wallets;
Original file line number Diff line number Diff line change @@ -173,6 +173,12 @@ class Node
173173 // ! Get unspent outputs associated with a transaction.
174174 virtual bool getUnspentOutput (const COutPoint& output, Coin& coin) = 0;
175175
176+ // ! Return default wallet directory.
177+ virtual std::string getWalletDir () = 0;
178+
179+ // ! Return available wallets in wallet directory.
180+ virtual std::vector<std::string> listWalletDir () = 0;
181+
176182 // ! Return interfaces for accessing wallets (if any).
177183 virtual std::vector<std::unique_ptr<Wallet>> getWallets () = 0;
178184
You can’t perform that action at this time.
0 commit comments