Make 100KB transaction size limit a consensus rule, rather than a standard rule.

This commit is contained in:
Sean Bowe
2016-10-08 00:00:23 -06:00
parent f2c99399b8
commit 74f15a73a1
6 changed files with 28 additions and 24 deletions

View File

@@ -121,17 +121,30 @@ TEST(checktransaction_tests, bad_txns_oversize) {
CMutableTransaction mtx = GetValidTransaction();
mtx.vin[0].scriptSig = CScript();
// 18 * (520char + DROP) + OP_1 = 9433 bytes
std::vector<unsigned char> vchData(520);
for (unsigned int i = 0; i < 4000; ++i)
for (unsigned int i = 0; i < 190; ++i)
mtx.vin[0].scriptSig << vchData << OP_DROP;
mtx.vin[0].scriptSig << OP_1;
CTransaction tx(mtx);
{
// Transaction is just under the limit...
CTransaction tx(mtx);
CValidationState state;
ASSERT_TRUE(CheckTransactionWithoutProofVerification(tx, state));
}
MockCValidationState state;
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-oversize", false)).Times(1);
CheckTransactionWithoutProofVerification(tx, state);
// Not anymore!
mtx.vin[1].scriptSig << vchData << OP_DROP;
mtx.vin[1].scriptSig << OP_1;
{
CTransaction tx(mtx);
ASSERT_EQ(::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION), 100202);
MockCValidationState state;
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-oversize", false)).Times(1);
CheckTransactionWithoutProofVerification(tx, state);
}
}
TEST(checktransaction_tests, bad_txns_vout_negative) {