Changeset View
Changeset View
Standalone View
Standalone View
src/test/transaction_tests.cpp
Show First 20 Lines • Show All 751 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(test_IsStandard) { | ||||
t.vout[1].scriptPubKey = CScript() << OP_RETURN; | t.vout[1].scriptPubKey = CScript() << OP_RETURN; | ||||
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | ||||
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; | ||||
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | BOOST_CHECK(!IsStandardTx(CTransaction(t), reason)); | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(tx_transaction_fee) { | |||||
std::vector<size_t> sizes = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512}; | |||||
for (size_t inputs : sizes) { | |||||
for (size_t outputs : sizes) { | |||||
CMutableTransaction mtx; | |||||
mtx.vin.resize(inputs); | |||||
mtx.vout.resize(outputs); | |||||
CTransaction tx(mtx); | |||||
auto txBillableSize = tx.GetBillableSize(); | |||||
auto txSize = tx.GetTotalSize(); | |||||
BOOST_CHECK(txBillableSize > 0); | |||||
if (inputs > outputs) { | |||||
BOOST_CHECK(txBillableSize < txSize); | |||||
} else { | |||||
BOOST_CHECK(txBillableSize >= txSize); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |