mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
interfaces: Add getWalletDir and listWalletDir to Node
This commit is contained in:
parent
fc4db35bfd
commit
d1b03b8e5f
@ -34,6 +34,16 @@ void DummyWalletInit::AddWalletOptions() const
|
||||
|
||||
const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
|
||||
|
||||
fs::path GetWalletDir()
|
||||
{
|
||||
throw std::logic_error("Wallet function called in non-wallet build.");
|
||||
}
|
||||
|
||||
std::vector<fs::path> ListWalletDir()
|
||||
{
|
||||
throw std::logic_error("Wallet function called in non-wallet build.");
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<CWallet>> GetWallets()
|
||||
{
|
||||
throw std::logic_error("Wallet function called in non-wallet build.");
|
||||
|
@ -38,6 +38,8 @@
|
||||
#include <univalue.h>
|
||||
|
||||
class CWallet;
|
||||
fs::path GetWalletDir();
|
||||
std::vector<fs::path> ListWalletDir();
|
||||
std::vector<std::shared_ptr<CWallet>> GetWallets();
|
||||
|
||||
namespace interfaces {
|
||||
@ -218,6 +220,18 @@ class NodeImpl : public Node
|
||||
LOCK(::cs_main);
|
||||
return ::pcoinsTip->GetCoin(output, coin);
|
||||
}
|
||||
std::string getWalletDir() override
|
||||
{
|
||||
return GetWalletDir().string();
|
||||
}
|
||||
std::vector<std::string> listWalletDir() override
|
||||
{
|
||||
std::vector<std::string> paths;
|
||||
for (auto& path : ListWalletDir()) {
|
||||
paths.push_back(path.string());
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
std::vector<std::unique_ptr<Wallet>> getWallets() override
|
||||
{
|
||||
std::vector<std::unique_ptr<Wallet>> wallets;
|
||||
|
@ -173,6 +173,12 @@ public:
|
||||
//! Get unspent outputs associated with a transaction.
|
||||
virtual bool getUnspentOutput(const COutPoint& output, Coin& coin) = 0;
|
||||
|
||||
//! Return default wallet directory.
|
||||
virtual std::string getWalletDir() = 0;
|
||||
|
||||
//! Return available wallets in wallet directory.
|
||||
virtual std::vector<std::string> listWalletDir() = 0;
|
||||
|
||||
//! Return interfaces for accessing wallets (if any).
|
||||
virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user