refactor: Replace string chain name constants with ChainTypes
This commit effectively moves the definition of these constants out of the chainparamsbase to their own file. Using the ChainType enums provides better type safety compared to passing around strings. The commit is part of an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager and other functionality that should not be part of the kernel library.
This commit is contained in:
78 files changed
+288
-229
No files matched your search
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <common/args.h>
|
||||
#include <univalue.h>
|
||||
#include <util/chaintype.h>
|
||||
#include <util/check.h>
|
||||
#include <util/fs.h>
|
||||
|
||||
@@ -13,7 +14,7 @@
|
||||
#include <wallet/test/init_test_fixture.h>
|
||||
|
||||
namespace wallet {
|
||||
InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
|
||||
InitWalletDirTestingSetup::InitWalletDirTestingSetup(const ChainType chainType) : BasicTestingSetup(chainType)
|
||||
{
|
||||
m_wallet_loader = MakeWalletLoader(*m_node.chain, m_args);
|
||||
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
#include <interfaces/wallet.h>
|
||||
#include <node/context.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/chaintype.h>
|
||||
|
||||
|
||||
namespace wallet {
|
||||
struct InitWalletDirTestingSetup: public BasicTestingSetup {
|
||||
explicit InitWalletDirTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
|
||||
explicit InitWalletDirTestingSetup(const ChainType chain_type = ChainType::MAIN);
|
||||
~InitWalletDirTestingSetup();
|
||||
void SetWalletDir(const fs::path& walletdir_path);
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
#include <wallet/test/wallet_test_fixture.h>
|
||||
|
||||
#include <scheduler.h>
|
||||
#include <util/chaintype.h>
|
||||
|
||||
namespace wallet {
|
||||
WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
|
||||
: TestingSetup(chainName),
|
||||
WalletTestingSetup::WalletTestingSetup(const ChainType chainType)
|
||||
: TestingSetup(chainType),
|
||||
m_wallet_loader{interfaces::MakeWalletLoader(*m_node.chain, *Assert(m_node.args))},
|
||||
m_wallet(m_node.chain.get(), "", CreateMockWalletDatabase())
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <interfaces/chain.h>
|
||||
#include <interfaces/wallet.h>
|
||||
#include <node/context.h>
|
||||
#include <util/chaintype.h>
|
||||
#include <util/check.h>
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
@@ -19,7 +20,7 @@ namespace wallet {
|
||||
/** Testing setup and teardown for wallet.
|
||||
*/
|
||||
struct WalletTestingSetup : public TestingSetup {
|
||||
explicit WalletTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
|
||||
explicit WalletTestingSetup(const ChainType chainType = ChainType::MAIN);
|
||||
~WalletTestingSetup();
|
||||
|
||||
std::unique_ptr<interfaces::WalletLoader> m_wallet_loader;
|
||||
|
||||
Reference in new issue
Block a user