| 56 | BOOST_FIXTURE_TEST_SUITE(compactblockprocessor_tests, CBProcessorFixture); |
| 57 | |
| 58 | BOOST_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 | |
| 90 | BOOST_AUTO_TEST_CASE(two_process_same) { |
| 91 | // Check that two nodes can process the same block at the same time, |
nothing calls this directly
no test coverage detected