| 20 | BOOST_FIXTURE_TEST_SUITE(compactthin_tests, Workaround); |
| 21 | |
| 22 | BOOST_AUTO_TEST_CASE(stub_tx_hashtypes) { |
| 23 | CBlock block = TestBlock1(); |
| 24 | CompactBlock cmpctblock(block, CoinbaseOnlyPrefiller{}); |
| 25 | |
| 26 | // CompactBlock is initialized with coinbase prefilled. |
| 27 | // Prefilled transactions have full hash. |
| 28 | CompactStub stub(cmpctblock); |
| 29 | std::vector<ThinTx> all = stub.allTransactions(); |
| 30 | for (auto& t : all) |
| 31 | BOOST_CHECK(!t.isNull()); |
| 32 | |
| 33 | // Coinbase should have full hash. |
| 34 | BOOST_CHECK(all.at(0).hasFull()); |
| 35 | BOOST_CHECK_EQUAL( |
| 36 | block.vtx.at(0).GetHash().ToString(), |
| 37 | all.at(0).full().ToString()); |
| 38 | |
| 39 | // All others should only have an obfuscated "short id" (we |
| 40 | // don't know full nor cheap hash) |
| 41 | for (size_t i = 1; i < all.size(); ++i) { |
| 42 | BOOST_CHECK(!all.at(i).hasFull()); |
| 43 | if (all.at(i).hasFull()) |
| 44 | std::cerr << all.at(i).full().ToString() << std::endl; |
| 45 | BOOST_CHECK(!all.at(i).hasCheap()); |
| 46 | BOOST_CHECK(all.at(i).equals(block.vtx.at(i).GetHash())); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | BOOST_AUTO_TEST_CASE(ids_are_correct) { |
| 51 | CBlock testblock = TestBlock1(); |
nothing calls this directly
no test coverage detected