Changeset View
Changeset View
Standalone View
Standalone View
src/test/validation_block_tests.cpp
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
// construct an invalid block (but with a valid header) | // construct an invalid block (but with a valid header) | ||||
const std::shared_ptr<const CBlock> BadBlock(const Config &config, | const std::shared_ptr<const CBlock> BadBlock(const Config &config, | ||||
const uint256 &prev_hash) { | const uint256 &prev_hash) { | ||||
auto pblock = Block(config, prev_hash); | auto pblock = Block(config, prev_hash); | ||||
CMutableTransaction coinbase_spend; | CMutableTransaction coinbase_spend; | ||||
coinbase_spend.vin.push_back( | coinbase_spend.vin.push_back( | ||||
CTxIn(COutPoint(pblock->vtx[0]->GetHash(), 0), CScript(), 0)); | CTxIn(COutPoint(pblock->vtx[0]->GetId(), 0), CScript(), 0)); | ||||
coinbase_spend.vout.push_back(pblock->vtx[0]->vout[0]); | coinbase_spend.vout.push_back(pblock->vtx[0]->vout[0]); | ||||
CTransactionRef tx = MakeTransactionRef(coinbase_spend); | CTransactionRef tx = MakeTransactionRef(coinbase_spend); | ||||
pblock->vtx.push_back(tx); | pblock->vtx.push_back(tx); | ||||
auto ret = FinalizeBlock(config, pblock); | auto ret = FinalizeBlock(config, pblock); | ||||
return ret; | return ret; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |