mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
test: Remove no longer needed MakeChain calls
These calls are no longer needed after edc316020e
from #19098 which started instantiating BasicTestingSetup.m_node.chain
Patch from MarcoFalke <falke.marco@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/19425#discussion_r526701954
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
This commit is contained in:
parent
6965f1352d
commit
5baa88fd38
9 changed files with 14 additions and 20 deletions
|
@ -17,7 +17,7 @@ BOOST_FIXTURE_TEST_SUITE(interfaces_tests, TestChain100Setup)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(findBlock)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
auto& chain = m_node.chain;
|
||||
const CChain& active = Assert(m_node.chainman)->ActiveChain();
|
||||
|
||||
uint256 hash;
|
||||
|
@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(findBlock)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(findFirstBlockWithTimeAndHeight)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
auto& chain = m_node.chain;
|
||||
const CChain& active = Assert(m_node.chainman)->ActiveChain();
|
||||
uint256 hash;
|
||||
int height;
|
||||
|
@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(findFirstBlockWithTimeAndHeight)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(findAncestorByHeight)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
auto& chain = m_node.chain;
|
||||
const CChain& active = Assert(m_node.chainman)->ActiveChain();
|
||||
uint256 hash;
|
||||
BOOST_CHECK(chain->findAncestorByHeight(active[20]->GetBlockHash(), 10, FoundBlock().hash(hash)));
|
||||
|
@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(findAncestorByHeight)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(findAncestorByHash)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
auto& chain = m_node.chain;
|
||||
const CChain& active = Assert(m_node.chainman)->ActiveChain();
|
||||
int height = -1;
|
||||
BOOST_CHECK(chain->findAncestorByHash(active[20]->GetBlockHash(), active[10]->GetBlockHash(), FoundBlock().height(height)));
|
||||
|
@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(findAncestorByHash)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(findCommonAncestor)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
auto& chain = m_node.chain;
|
||||
const CChain& active = Assert(m_node.chainman)->ActiveChain();
|
||||
auto* orig_tip = active.Tip();
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
|
@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(findCommonAncestor)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(hasBlocks)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
auto& chain = m_node.chain;
|
||||
const CChain& active = Assert(m_node.chainman)->ActiveChain();
|
||||
|
||||
// Test ranges
|
||||
|
|
|
@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
|
|||
// Make sure that can use BnB when there are preset inputs
|
||||
empty_wallet();
|
||||
{
|
||||
std::unique_ptr<CWallet> wallet = MakeUnique<CWallet>(m_chain.get(), "", CreateMockWalletDatabase());
|
||||
std::unique_ptr<CWallet> wallet = MakeUnique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
|
||||
bool firstRun;
|
||||
wallet->LoadWallet(firstRun);
|
||||
wallet->SetupLegacyScriptPubKeyMan();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
|
||||
{
|
||||
m_wallet_client = MakeWalletClient(*m_chain, *Assert(m_node.args));
|
||||
m_wallet_client = MakeWalletClient(*m_node.chain, *Assert(m_node.args));
|
||||
|
||||
std::string sep;
|
||||
sep += fs::path::preferred_separator;
|
||||
|
|
|
@ -19,7 +19,6 @@ struct InitWalletDirTestingSetup: public BasicTestingSetup {
|
|||
fs::path m_datadir;
|
||||
fs::path m_cwd;
|
||||
std::map<std::string, fs::path> m_walletdir_path_cases;
|
||||
std::unique_ptr<interfaces::Chain> m_chain = interfaces::MakeChain(m_node);
|
||||
std::unique_ptr<interfaces::WalletClient> m_wallet_client;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||
CKey uncompressedKey;
|
||||
uncompressedKey.MakeNewKey(false);
|
||||
CPubKey uncompressedPubkey = uncompressedKey.GetPubKey();
|
||||
NodeContext node;
|
||||
std::unique_ptr<interfaces::Chain> chain = interfaces::MakeChain(node);
|
||||
std::unique_ptr<interfaces::Chain>& chain = m_node.chain;
|
||||
|
||||
CScript scriptPubKey;
|
||||
isminetype result;
|
||||
|
|
|
@ -17,9 +17,7 @@ BOOST_FIXTURE_TEST_SUITE(scriptpubkeyman_tests, BasicTestingSetup)
|
|||
BOOST_AUTO_TEST_CASE(CanProvide)
|
||||
{
|
||||
// Set up wallet and keyman variables.
|
||||
NodeContext node;
|
||||
std::unique_ptr<interfaces::Chain> chain = interfaces::MakeChain(node);
|
||||
CWallet wallet(chain.get(), "", CreateDummyWalletDatabase());
|
||||
CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase());
|
||||
LegacyScriptPubKeyMan& keyman = *wallet.GetOrCreateLegacyScriptPubKeyMan();
|
||||
|
||||
// Make a 1 of 2 multisig script
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
|
||||
: TestingSetup(chainName),
|
||||
m_wallet(m_chain.get(), "", CreateMockWalletDatabase())
|
||||
m_wallet(m_node.chain.get(), "", CreateMockWalletDatabase())
|
||||
{
|
||||
bool fFirstRun;
|
||||
m_wallet.LoadWallet(fFirstRun);
|
||||
m_chain_notifications_handler = m_chain->handleNotifications({ &m_wallet, [](CWallet*) {} });
|
||||
m_chain_notifications_handler = m_node.chain->handleNotifications({ &m_wallet, [](CWallet*) {} });
|
||||
m_wallet_client->registerRpcs();
|
||||
}
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
struct WalletTestingSetup : public TestingSetup {
|
||||
explicit WalletTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
|
||||
|
||||
std::unique_ptr<interfaces::Chain> m_chain = interfaces::MakeChain(m_node);
|
||||
std::unique_ptr<interfaces::WalletClient> m_wallet_client = interfaces::MakeWalletClient(*m_chain, *Assert(m_node.args));
|
||||
std::unique_ptr<interfaces::WalletClient> m_wallet_client = interfaces::MakeWalletClient(*m_node.chain, *Assert(m_node.args));
|
||||
CWallet m_wallet;
|
||||
std::unique_ptr<interfaces::Handler> m_chain_notifications_handler;
|
||||
};
|
||||
|
|
|
@ -786,8 +786,7 @@ BOOST_FIXTURE_TEST_CASE(CreateWallet, TestChain100Setup)
|
|||
|
||||
BOOST_FIXTURE_TEST_CASE(ZapSelectTx, TestChain100Setup)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
auto wallet = TestLoadWallet(*chain);
|
||||
auto wallet = TestLoadWallet(*m_node.chain);
|
||||
CKey key;
|
||||
key.MakeNewKey(true);
|
||||
AddKey(*wallet, key);
|
||||
|
|
Loading…
Add table
Reference in a new issue