test: remove connman local from BasicTestingSetup

`NodeContext` member was moved from `TestingSetup` to
`BasicTestingSetup` in bitcoin#18571 but `connman` (which was a remnant
from when `NodeContext` was absent) wasn't removed.

Let's resolve that.
This commit is contained in:
Kittywhiskers Van Gogh 2024-09-01 15:16:42 +00:00
parent df43565464
commit b30f0fa441
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 7 additions and 9 deletions

View File

@ -177,8 +177,11 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
SetupNetworking();
InitSignatureCache();
InitScriptExecutionCache();
m_node.addrman = std::make_unique<AddrMan>(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
m_node.chain = interfaces::MakeChain(m_node);
m_node.addrman = std::make_unique<AddrMan>(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
m_node.connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests.
// while g_wallet_init_interface is init here at very early stage
// we can't get rid of unique_ptr from wallet/contex.h
// TODO: remove unique_ptr from wallet/context.h after bitcoin/bitcoin#22219
@ -186,7 +189,6 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
fCheckBlockIndex = true;
m_node.evodb = std::make_unique<CEvoDB>(1 << 20, true, true);
m_node.mnhf_manager = std::make_unique<CMNHFManager>(*m_node.evodb);
connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman);
llmq::quorumSnapshotManager.reset(new llmq::CQuorumSnapshotManager(*m_node.evodb));
m_node.cpoolman = std::make_unique<CCreditPoolManager>(*m_node.evodb);
static bool noui_connected = false;
@ -200,11 +202,12 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
BasicTestingSetup::~BasicTestingSetup()
{
SetMockTime(0s); // Reset mocktime for following tests
connman.reset();
llmq::quorumSnapshotManager.reset();
m_node.cpoolman.reset();
llmq::quorumSnapshotManager.reset();
m_node.mnhf_manager.reset();
m_node.evodb.reset();
m_node.connman.reset();
m_node.addrman.reset();
LogInstance().DisconnectTestLogger();
fs::remove_all(m_path_root);
@ -227,8 +230,6 @@ ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::ve
m_node.chainman = std::make_unique<ChainstateManager>();
m_node.chainman->m_blockman.m_block_tree_db = std::make_unique<CBlockTreeDB>(1 << 20, true);
m_node.connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests.
m_node.mn_metaman = std::make_unique<CMasternodeMetaMan>();
m_node.netfulfilledman = std::make_unique<CNetFulfilledRequestManager>();
m_node.sporkman = std::make_unique<CSporkManager>();
@ -252,8 +253,6 @@ ChainTestingSetup::~ChainTestingSetup()
m_node.sporkman.reset();
m_node.netfulfilledman.reset();
m_node.mn_metaman.reset();
m_node.connman.reset();
m_node.addrman.reset();
m_node.args = nullptr;
m_node.mempool.reset();
m_node.scheduler.reset();

View File

@ -88,7 +88,6 @@ struct BasicTestingSetup {
explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN, const std::vector<const char*>& extra_args = {});
~BasicTestingSetup();
std::unique_ptr<CConnman> connman;
const fs::path m_path_root;
ArgsManager m_args;
};