Changeset View
Changeset View
Standalone View
Standalone View
src/test/transaction_tests.cpp
Show First 20 Lines • Show All 795 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(test_IsStandard) { | ||||
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | ||||
BOOST_CHECK_EQUAL(reason, "multi-op-return"); | BOOST_CHECK_EQUAL(reason, "multi-op-return"); | ||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN; | t.vout[0].scriptPubKey = CScript() << OP_RETURN; | ||||
t.vout[1].scriptPubKey = CScript() << OP_RETURN; | t.vout[1].scriptPubKey = CScript() << OP_RETURN; | ||||
reason.clear(); | reason.clear(); | ||||
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | ||||
BOOST_CHECK_EQUAL(reason, "multi-op-return"); | BOOST_CHECK_EQUAL(reason, "multi-op-return"); | ||||
// Check large scriptSig (non-standard if size is >1650 bytes) | |||||
t.vout.resize(1); | |||||
t.vout[0].nValue = MAX_MONEY; | |||||
t.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key.GetPubKey())); | |||||
// OP_PUSHDATA2 with len (3 bytes) + data (1647 bytes) = 1650 bytes | |||||
t.vin[0].scriptSig = CScript() << std::vector<uint8_t>(1647, 0); // 1650 | |||||
BOOST_CHECK(IsStandardTx(CTransaction(t), reason)); | |||||
t.vin[0].scriptSig = CScript() << std::vector<uint8_t>(1648, 0); // 1651 | |||||
reason.clear(); | |||||
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | |||||
BOOST_CHECK_EQUAL(reason, "scriptsig-size"); | |||||
} | } | ||||
BOOST_AUTO_TEST_CASE(txsize_activation_test) { | BOOST_AUTO_TEST_CASE(txsize_activation_test) { | ||||
const Config &config = GetConfig(); | const Config &config = GetConfig(); | ||||
const Consensus::Params ¶ms = config.GetChainParams().GetConsensus(); | const Consensus::Params ¶ms = config.GetChainParams().GetConsensus(); | ||||
const int32_t magneticAnomalyActivationHeight = | const int32_t magneticAnomalyActivationHeight = | ||||
params.magneticAnomalyHeight; | params.magneticAnomalyHeight; | ||||
Show All 12 Lines |