MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / TestingSetup

Method TestingSetup

src/test/util/setup_common.cpp:374–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374TestingSetup::TestingSetup(
375 const ChainType chainType,
376 TestOpts opts)
377 : ChainTestingSetup(chainType, opts)
378{
379 m_coins_db_in_memory = opts.coins_db_in_memory;
380 m_block_tree_db_in_memory = opts.block_tree_db_in_memory;
381 // Ideally we'd move all the RPC tests to the functional testing framework
382 // instead of unit tests, but for now we need these here.
383 RegisterAllCoreRPCCommands(tableRPC);
384
385 LoadVerifyActivateChainstate();
386
387 if (!opts.setup_net) return;
388
389 m_node.netgroupman = std::make_unique<NetGroupManager>(NetGroupManager::NoAsmap());
390 m_node.addrman = std::make_unique<AddrMan>(*m_node.netgroupman,
391 /*deterministic=*/false,
392 m_node.args->GetIntArg("-checkaddrman", 0));
393 m_node.banman = std::make_unique<BanMan>(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
394 m_node.connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman, Params()); // Deterministic randomness for tests.
395 auto mining_args{node::ReadMiningArgs(*m_node.args)};
396 Assert(mining_args);
397 m_node.mining_args = std::move(*mining_args);
398 PeerManager::Options peerman_opts;
399 ApplyArgsManOptions(*m_node.args, peerman_opts);
400 peerman_opts.deterministic_rng = true;
401 m_node.peerman = PeerManager::make(*m_node.connman, *m_node.addrman,
402 m_node.banman.get(), *m_node.chainman,
403 *m_node.mempool, *m_node.warnings,
404 peerman_opts);
405
406 {
407 CConnman::Options options;
408 options.m_msgproc = m_node.peerman.get();
409 m_node.connman->Init(options);
410 }
411}
412
413TestChain100Setup::TestChain100Setup(
414 const ChainType chain_type,

Callers

nothing calls this directly

Calls 7

ReadMiningArgsFunction · 0.85
GetDataDirBaseMethod · 0.80
ParamsClass · 0.50
ApplyArgsManOptionsFunction · 0.50
getMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected