Changeset View
Changeset View
Standalone View
Standalone View
src/test/miner_tests.cpp
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | static void TestPackageSelection(const CChainParams &chainparams, | ||||
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 = int64_t(5000000000LL - 1000 - 50000) * SATOSHI; | tx.vout[0].nValue = int64_t(5000000000LL - 1000 - 50000) * SATOSHI; | ||||
TxId freeTxId = tx.GetId(); | TxId freeTxId = tx.GetId(); | ||||
g_mempool.addUnchecked(freeTxId, entry.Fee(Amount::zero()).FromTx(tx)); | g_mempool.addUnchecked(freeTxId, entry.Fee(Amount::zero()).FromTx(tx)); | ||||
size_t freeTxSize = GetVirtualTransactionSize(CTransaction(tx)); | size_t freeTxSize = GetSerializeSize(tx, PROTOCOL_VERSION); | ||||
// 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) - SATOSHI; | Amount feeToUse = blockMinFeeRate.GetFee(2 * freeTxSize) - SATOSHI; | ||||
tx.vin[0].prevout = COutPoint(freeTxId, 0); | tx.vin[0].prevout = COutPoint(freeTxId, 0); | ||||
tx.vout[0].nValue = | tx.vout[0].nValue = | ||||
int64_t(5000000000LL - 1000 - 50000) * SATOSHI - feeToUse; | int64_t(5000000000LL - 1000 - 50000) * SATOSHI - feeToUse; | ||||
▲ Show 20 Lines • Show All 620 Lines • Show Last 20 Lines |