Changeset View
Changeset View
Standalone View
Standalone View
src/test/blockcheck_tests.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(blockfail) { | ||||
tx.vin[0].scriptSig.resize(0); | tx.vin[0].scriptSig.resize(0); | ||||
block.vtx[0] = MakeTransactionRef(tx); | block.vtx[0] = MakeTransactionRef(tx); | ||||
RunCheckOnBlock(config, block, "bad-cb-length"); | RunCheckOnBlock(config, block, "bad-cb-length"); | ||||
// Oversize block. | // Oversize block. | ||||
tx = CMutableTransaction(coinbaseTx); | tx = CMutableTransaction(coinbaseTx); | ||||
block.vtx[0] = MakeTransactionRef(tx); | block.vtx[0] = MakeTransactionRef(tx); | ||||
auto txSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); | auto txSize = ::GetSerializeSize(tx, PROTOCOL_VERSION); | ||||
auto maxTxCount = ((DEFAULT_MAX_BLOCK_SIZE - 1) / txSize) - 1; | auto maxTxCount = ((DEFAULT_MAX_BLOCK_SIZE - 1) / txSize) - 1; | ||||
for (size_t i = 1; i < maxTxCount; i++) { | for (size_t i = 1; i < maxTxCount; i++) { | ||||
tx.vin[0].prevout = InsecureRandOutPoint(); | tx.vin[0].prevout = InsecureRandOutPoint(); | ||||
block.vtx.push_back(MakeTransactionRef(tx)); | block.vtx.push_back(MakeTransactionRef(tx)); | ||||
} | } | ||||
// Check that at this point, we still accept the block. | // Check that at this point, we still accept the block. | ||||
Show All 10 Lines |