construct an invalid block (but with a valid header)
| 115 | |
| 116 | // construct an invalid block (but with a valid header) |
| 117 | std::shared_ptr<const CBlock> MinerTestingSetup::BadBlock(const uint256& prev_hash) |
| 118 | { |
| 119 | auto pblock = Block(prev_hash); |
| 120 | |
| 121 | CMutableTransaction coinbase_spend; |
| 122 | coinbase_spend.vin.push_back(CTxIn(COutPoint(pblock->vtx[0]->GetHash(), 0), CScript(), 0)); |
| 123 | coinbase_spend.vout.push_back(pblock->vtx[0]->vout[0]); |
| 124 | |
| 125 | CTransactionRef tx = MakeTransactionRef(coinbase_spend); |
| 126 | pblock->vtx.push_back(tx); |
| 127 | |
| 128 | auto ret = FinalizeBlock(pblock); |
| 129 | return ret; |
| 130 | } |
| 131 | |
| 132 | void MinerTestingSetup::BuildChain(const uint256& root, int height, const unsigned int invalid_rate, const unsigned int branch_rate, const unsigned int max_size, std::vector<std::shared_ptr<const CBlock>>& blocks) |
| 133 | { |