12#include <validation.h>
14#include <boost/test/unit_test.hpp>
36 BOOST_REQUIRE(mining);
38 BlockAssembler::Options options;
39 options.include_dummy_extranonce =
true;
40 std::unique_ptr<BlockTemplate> block_template;
46 block_template = mining->createNewBlock(options,
false);
47 BOOST_REQUIRE(block_template);
50 BOOST_REQUIRE_EQUAL(block_template->getBlockHeader().Time(), template_time);
55 auto should_be_nullptr = block_template->waitNext(wait_options);
56 BOOST_REQUIRE(should_be_nullptr ==
nullptr);
60 should_be_nullptr = block_template->waitNext(wait_options);
61 BOOST_REQUIRE(should_be_nullptr ==
nullptr);
67 block_template = block_template->waitNext(wait_options);
68 BOOST_REQUIRE(block_template);
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
Block template interface.
Interface giving clients (RPC, Stratum v2 Template Provider in the future) ability to create block te...
Generate a new block, without valid proof-of-work.
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()
std::unique_ptr< Mining > MakeMining(node::NodeContext &node, bool wait_loaded=true)
Return implementation of Mining interface.
Identical to TestingSetup, but chain set to testnet4.
MillisecondsDouble timeout
How long to wait before returning nullptr instead of a new template.
std::unique_ptr< ChainstateManager > chainman
std::unique_ptr< Mining > MakeMining()
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
BOOST_AUTO_TEST_CASE(MiningInterface)
std::chrono::duration< double, std::chrono::milliseconds::period > MillisecondsDouble