| 17 | BOOST_FIXTURE_TEST_SUITE(blockencodings_tests, RegTestingSetup) |
| 18 | |
| 19 | static CBlock BuildBlockTestCase() { |
| 20 | CBlock block; |
| 21 | CMutableTransaction tx; |
| 22 | tx.vin.resize(1); |
| 23 | tx.vin[0].scriptSig.resize(10); |
| 24 | tx.vout.resize(1); |
| 25 | tx.vout[0].nValue = 42; |
| 26 | |
| 27 | block.vtx.resize(3); |
| 28 | block.vtx[0] = MakeTransactionRef(tx); |
| 29 | block.nVersion = 42; |
| 30 | block.hashPrevBlock = InsecureRand256(); |
| 31 | block.nBits = 0x207fffff; |
| 32 | |
| 33 | tx.vin[0].prevout.hash = InsecureRand256(); |
| 34 | tx.vin[0].prevout.n = 0; |
| 35 | block.vtx[1] = MakeTransactionRef(tx); |
| 36 | |
| 37 | tx.vin.resize(10); |
| 38 | for (size_t i = 0; i < tx.vin.size(); i++) { |
| 39 | tx.vin[i].prevout.hash = InsecureRand256(); |
| 40 | tx.vin[i].prevout.n = 0; |
| 41 | } |
| 42 | block.vtx[2] = MakeTransactionRef(tx); |
| 43 | |
| 44 | bool mutated; |
| 45 | block.hashMerkleRoot = BlockMerkleRoot(block, &mutated); |
| 46 | assert(!mutated); |
| 47 | while (!CheckProofOfWork(block.GetHash(), block.nBits, Params().GetConsensus())) ++block.nNonce; |
| 48 | return block; |
| 49 | } |
| 50 | |
| 51 | // Number of shared use_counts we expect for a tx we haven't touched |
| 52 | // (block + mempool + our copy from the GetSharedTx call) |
no test coverage detected