MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/test/compactblockprocessor_tests.cpp:58–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56BOOST_FIXTURE_TEST_SUITE(compactblockprocessor_tests, CBProcessorFixture);
57
58BOOST_AUTO_TEST_CASE(accepts_parallel_compacts) {
59
60 // We may receive a block announcement
61 // as a compact block while we've already
62 // requested a different block as compact.
63 // We need to be willing to receive both.
64
65 DummyNode node(42, thinmg.get());
66 CompactWorker w(*thinmg, node.id);
67
68 // start work on first block.
69 uint256 block1 = uint256S("0xf00");
70 w.addWork(block1);
71
72 CompactBlockProcessor p(node, w, headerp);
73
74 CBlock block2 = TestBlock1();
75 CDataStream blockstream = toStream(
76 CompactBlock(block2, CoinbaseOnlyPrefiller{}));
77
78 // cblock2 is announced, should start work on
79 // that too.
80 p(blockstream, mpool, MAX_BLOCK_SIZE, 1);
81
82 BOOST_CHECK(w.isWorkingOn(block1));
83 BOOST_CHECK(w.isWorkingOn(block2.GetHash()));
84 BOOST_CHECK_EQUAL(1, thinmg->numWorkers(block1));
85 BOOST_CHECK_EQUAL(1, thinmg->numWorkers(block2.GetHash()));
86 w.stopAllWork();
87 thinmg.reset();
88}
89
90BOOST_AUTO_TEST_CASE(two_process_same) {
91 // Check that two nodes can process the same block at the same time,

Callers

nothing calls this directly

Calls 10

uint256SFunction · 0.85
TestBlock1Function · 0.85
CompactBlockClass · 0.85
isWorkingOnMethod · 0.80
numWorkersMethod · 0.80
resetMethod · 0.80
getMethod · 0.45
addWorkMethod · 0.45
GetHashMethod · 0.45
stopAllWorkMethod · 0.45

Tested by

no test coverage detected