wallet: Pass unused args to StartWallets

This refactor does not change behavior
This commit is contained in:
MarcoFalke
2020-05-11 17:40:21 +02:00
parent fa6c186436
commit faf8401c19
9 changed files with 29 additions and 18 deletions

View File

@@ -15,6 +15,7 @@
#include <string>
#include <vector>
class ArgsManager;
class CBlock;
class CFeeRate;
class CRPCCommand;
@@ -322,7 +323,7 @@ std::unique_ptr<Chain> MakeChain(NodeContext& node);
//! analysis, or fee estimation. These clients need to expose their own
//! MakeXXXClient functions returning their implementations of the ChainClient
//! interface.
std::unique_ptr<ChainClient> MakeWalletClient(Chain& chain, std::vector<std::string> wallet_filenames);
std::unique_ptr<ChainClient> MakeWalletClient(Chain& chain, ArgsManager& args, std::vector<std::string> wallet_filenames);
} // namespace interfaces

View File

@@ -483,10 +483,11 @@ public:
class WalletClientImpl : public ChainClient
{
public:
WalletClientImpl(Chain& chain, std::vector<std::string> wallet_filenames)
WalletClientImpl(Chain& chain, ArgsManager& args, std::vector<std::string> wallet_filenames)
: m_wallet_filenames(std::move(wallet_filenames))
{
m_context.chain = &chain;
m_context.args = &args;
}
void registerRpcs() override
{
@@ -499,7 +500,7 @@ public:
}
bool verify() override { return VerifyWallets(*m_context.chain, m_wallet_filenames); }
bool load() override { return LoadWallets(*m_context.chain, m_wallet_filenames); }
void start(CScheduler& scheduler) override { return StartWallets(scheduler); }
void start(CScheduler& scheduler) override { return StartWallets(scheduler, *Assert(m_context.args)); }
void flush() override { return FlushWallets(); }
void stop() override { return StopWallets(); }
void setMockTime(int64_t time) override { return SetMockTime(time); }
@@ -514,7 +515,7 @@ public:
~WalletClientImpl() override { UnloadWallets(); }
WalletContext m_context;
std::vector<std::string> m_wallet_filenames;
const std::vector<std::string> m_wallet_filenames;
std::vector<std::unique_ptr<Handler>> m_rpc_handlers;
std::list<CRPCCommand> m_rpc_commands;
};
@@ -523,9 +524,9 @@ public:
std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet) { return wallet ? MakeUnique<WalletImpl>(wallet) : nullptr; }
std::unique_ptr<ChainClient> MakeWalletClient(Chain& chain, std::vector<std::string> wallet_filenames)
std::unique_ptr<ChainClient> MakeWalletClient(Chain& chain, ArgsManager& args, std::vector<std::string> wallet_filenames)
{
return MakeUnique<WalletClientImpl>(chain, std::move(wallet_filenames));
return MakeUnique<WalletClientImpl>(chain, args, std::move(wallet_filenames));
}
} // namespace interfaces