diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-04-17 22:20:59 +0200 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-05-09 15:49:14 +0200 |
commit | ba8fc7d788932b25864fb260ca14983aa2398c23 (patch) | |
tree | 3049d9b5282c243faf7e0ab1e7d2a7ee17937a36 /src/wallet/test | |
parent | 401453df419af35957ec711423ac3d93ad512fe8 (diff) |
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.
Diffstat (limited to 'src/wallet/test')
-rw-r--r-- | src/wallet/test/init_test_fixture.cpp | 3 | ||||
-rw-r--r-- | src/wallet/test/init_test_fixture.h | 3 | ||||
-rw-r--r-- | src/wallet/test/wallet_test_fixture.cpp | 5 | ||||
-rw-r--r-- | src/wallet/test/wallet_test_fixture.h | 3 |
4 files changed, 9 insertions, 5 deletions
diff --git a/src/wallet/test/init_test_fixture.cpp b/src/wallet/test/init_test_fixture.cpp index 0adc63876c..5bdf36ec19 100644 --- a/src/wallet/test/init_test_fixture.cpp +++ b/src/wallet/test/init_test_fixture.cpp @@ -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); diff --git a/src/wallet/test/init_test_fixture.h b/src/wallet/test/init_test_fixture.h index df5819fd1d..ac7bb8997c 100644 --- a/src/wallet/test/init_test_fixture.h +++ b/src/wallet/test/init_test_fixture.h @@ -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); diff --git a/src/wallet/test/wallet_test_fixture.cpp b/src/wallet/test/wallet_test_fixture.cpp index 2dd8f9ad33..369526d17f 100644 --- a/src/wallet/test/wallet_test_fixture.cpp +++ b/src/wallet/test/wallet_test_fixture.cpp @@ -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()) { diff --git a/src/wallet/test/wallet_test_fixture.h b/src/wallet/test/wallet_test_fixture.h index f1ef15a282..4aae02e075 100644 --- a/src/wallet/test/wallet_test_fixture.h +++ b/src/wallet/test/wallet_test_fixture.h @@ -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; |