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

Function BOOST_AUTO_TEST_CASE

src/test/compactthin_tests.cpp:22–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20BOOST_FIXTURE_TEST_SUITE(compactthin_tests, Workaround);
21
22BOOST_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
50BOOST_AUTO_TEST_CASE(ids_are_correct) {
51 CBlock testblock = TestBlock1();

Callers

nothing calls this directly

Calls 15

TestBlock1Function · 0.85
GetShortIDFunction · 0.85
GetDummyThinBlockMgFunction · 0.85
hasFullMethod · 0.80
hasCheapMethod · 0.80
equalsMethod · 0.80
obfuscatedMethod · 0.80
allTransactionsMethod · 0.45
isNullMethod · 0.45
ToStringMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected