6#include <chainparams.h>
18#include <validation.h>
21#include <boost/test/unit_test.hpp>
33 auto curr_time = GetTime<std::chrono::seconds>();
35 auto& block_template_manager{*
Assert(
node.block_template_manager)};
36 auto block_template{block_template_manager.CreateNewTemplate({})};
37 BOOST_REQUIRE(block_template);
38 CBlock block{block_template->block};
40 block.fChecked =
true;
42 Assert(
node.chainman->ProcessNewBlock(std::make_shared<const CBlock>(block),
true,
true,
nullptr));
43 node.validation_signals->SyncWithValidationInterfaceQueue();
59 uint64_t tip_block_time = tip->GetBlockTime();
60 int tip_block_height = tip->nHeight;
61 peerman->SetBestBlock(tip_block_height, std::chrono::seconds{tip_block_time});
63 clock.
set(std::chrono::seconds{tip_block_time + 1});
71 clock += std::chrono::seconds{consensus.nPowTargetSpacing * 2};
#define Assert(val)
Identity function.
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
void set(NodeSeconds t)
Set mocktime.
static std::unique_ptr< PeerManager > make(CConnman &connman, AddrMan &addrman, BanMan *banman, ChainstateManager &chainman, CTxMemPool &pool, node::Warnings &warnings, Options opts)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK(expr)
BOOST_AUTO_TEST_CASE(connections_desirable_service_flags)
static void mineBlock(node::NodeContext &node, FakeNodeClock &clock, std::chrono::seconds block_time)
static constexpr int64_t NODE_NETWORK_LIMITED_ALLOW_CONN_BLOCKS
Window, in blocks, for connecting to NODE_NETWORK_LIMITED peers.
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params ¶ms)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
ServiceFlags
nServices flags
Identical to TestingSetup, but chain set to regtest.
std::unique_ptr< ValidationSignals > validation_signals
Issues calls about blocks and transactions.
std::unique_ptr< CConnman > connman
std::unique_ptr< CTxMemPool > mempool
std::unique_ptr< AddrMan > addrman
std::unique_ptr< ChainstateManager > chainman
std::unique_ptr< node::Warnings > warnings
Manages all the node warnings.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.