construct an invalid block (but with a valid header)
| 86 | |
| 87 | // construct an invalid block (but with a valid header) |
| 88 | const std::shared_ptr<const CBlock> BadBlock(const uint256& prev_hash) |
| 89 | { |
| 90 | auto pblock = Block(prev_hash); |
| 91 | |
| 92 | CMutableTransaction coinbase_spend; |
| 93 | coinbase_spend.vin.push_back(CTxIn(COutPoint(pblock->vtx[0]->GetHash(), 0), CScript(), 0)); |
| 94 | coinbase_spend.vout.push_back(pblock->vtx[0]->vout[0]); |
| 95 | |
| 96 | CTransactionRef tx = MakeTransactionRef(coinbase_spend); |
| 97 | pblock->vtx.push_back(tx); |
| 98 | |
| 99 | auto ret = FinalizeBlock(pblock); |
| 100 | return ret; |
| 101 | } |
| 102 | |
| 103 | void 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) |
| 104 | { |
no test coverage detected