14#include <validation.h>
16#include <boost/test/unit_test.hpp>
39 BOOST_REQUIRE(mining);
41 std::unique_ptr<BlockTemplate> block_template;
47 block_template = mining->createNewBlock({},
false);
48 BOOST_REQUIRE(block_template);
51 BOOST_REQUIRE_EQUAL(block_template->getBlockHeader().Time(), template_time);
56 auto should_be_nullptr = block_template->waitNext(wait_options);
57 BOOST_REQUIRE(should_be_nullptr ==
nullptr);
61 should_be_nullptr = block_template->waitNext(wait_options);
62 BOOST_REQUIRE(should_be_nullptr ==
nullptr);
68 block_template = block_template->waitNext(wait_options);
69 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...
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()
is used externally by mining IPC clients, so it should only declare simple data definitions.
std::unique_ptr< Mining > MakeMining(const 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