Changeset View
Changeset View
Standalone View
Standalone View
src/test/miner_tests.cpp
Show First 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | void TestPackageSelection(Config &config, CScript scriptPubKey, | ||||
BOOST_CHECK(pblocktemplate->block.vtx[3]->GetId() == mediumFeeTxId); | BOOST_CHECK(pblocktemplate->block.vtx[3]->GetId() == mediumFeeTxId); | ||||
// Test that a package below the block min tx fee doesn't get included | // Test that a package below the block min tx fee doesn't get included | ||||
tx.vin[0].prevout = COutPoint(highFeeTxId, 0); | tx.vin[0].prevout = COutPoint(highFeeTxId, 0); | ||||
// 0 fee. | // 0 fee. | ||||
tx.vout[0].nValue = Amount(5000000000LL - 1000 - 50000); | tx.vout[0].nValue = Amount(5000000000LL - 1000 - 50000); | ||||
TxId freeTxId = tx.GetId(); | TxId freeTxId = tx.GetId(); | ||||
mempool.addUnchecked(freeTxId, entry.Fee(Amount(0)).FromTx(tx)); | mempool.addUnchecked(freeTxId, entry.Fee(Amount(0)).FromTx(tx)); | ||||
size_t freeTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); | size_t freeTxSize = CTransaction(tx).GetBillableSize(); | ||||
// Calculate a fee on child transaction that will put the package just | // Calculate a fee on child transaction that will put the package just | ||||
// below the block min tx fee (assuming 1 child tx of the same size). | // below the block min tx fee (assuming 1 child tx of the same size). | ||||
Amount feeToUse = blockMinFeeRate.GetFee(2 * freeTxSize) - Amount(1); | Amount feeToUse = blockMinFeeRate.GetFee(2 * freeTxSize) - Amount(1); | ||||
tx.vin[0].prevout = COutPoint(freeTxId, 0); | tx.vin[0].prevout = COutPoint(freeTxId, 0); | ||||
tx.vout[0].nValue = Amount(5000000000LL - 1000 - 50000) - feeToUse; | tx.vout[0].nValue = Amount(5000000000LL - 1000 - 50000) - feeToUse; | ||||
TxId lowFeeTxId = tx.GetId(); | TxId lowFeeTxId = tx.GetId(); | ||||
▲ Show 20 Lines • Show All 613 Lines • Show Last 20 Lines |