Changeset View
Changeset View
Standalone View
Standalone View
src/test/transaction_tests.cpp
Show First 20 Lines • Show All 782 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(txsize_activation_test) { | ||||
BOOST_CHECK(ContextualCheckTransaction(config, minTx, state, 1234, 5678, | BOOST_CHECK(ContextualCheckTransaction(config, minTx, state, 1234, 5678, | ||||
magneticAnomalyActivationTime - 1)); | magneticAnomalyActivationTime - 1)); | ||||
BOOST_CHECK(!ContextualCheckTransaction(config, minTx, state, 1234, 5678, | BOOST_CHECK(!ContextualCheckTransaction(config, minTx, state, 1234, 5678, | ||||
magneticAnomalyActivationTime)); | magneticAnomalyActivationTime)); | ||||
BOOST_CHECK_EQUAL(state.GetRejectCode(), REJECT_INVALID); | BOOST_CHECK_EQUAL(state.GetRejectCode(), REJECT_INVALID); | ||||
BOOST_CHECK_EQUAL(state.GetRejectReason(), "bad-txns-undersize"); | BOOST_CHECK_EQUAL(state.GetRejectReason(), "bad-txns-undersize"); | ||||
} | } | ||||
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); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
deadalnix: The addition of `GetBillableSize` and that test could go in now if they were in their own diff. | |||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |
The addition of GetBillableSize and that test could go in now if they were in their own diff.
However there are vast changes to the mempool code coming with it. The changes to the mempool do not come up with a test.
So I suggest GetBillableSize to be split in its own diff, and this one to be rebased on it. With the addition of a test for the mempool accounting, that second part should be good to go.