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