Skip to content

Commit 6b331e6

Browse files
committed
Fix to have miner test aware of new separate block min tx fee
1 parent de6400d commit 6b331e6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/test/miner_tests.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "consensus/validation.h"
1010
#include "validation.h"
1111
#include "miner.h"
12+
#include "policy/policy.h"
1213
#include "pubkey.h"
1314
#include "script/standard.h"
1415
#include "txmempool.h"
@@ -24,6 +25,8 @@
2425

2526
BOOST_FIXTURE_TEST_SUITE(miner_tests, TestingSetup)
2627

28+
static CFeeRate blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE);
29+
2730
static
2831
struct {
2932
unsigned char extranonce;
@@ -112,16 +115,16 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey,
112115
BOOST_CHECK(pblocktemplate->block.vtx[2]->GetHash() == hashHighFeeTx);
113116
BOOST_CHECK(pblocktemplate->block.vtx[3]->GetHash() == hashMediumFeeTx);
114117

115-
// Test that a package below the min relay fee doesn't get included
118+
// Test that a package below the block min tx fee doesn't get included
116119
tx.vin[0].prevout.hash = hashHighFeeTx;
117120
tx.vout[0].nValue = 5000000000LL - 1000 - 50000; // 0 fee
118121
uint256 hashFreeTx = tx.GetHash();
119122
mempool.addUnchecked(hashFreeTx, entry.Fee(0).FromTx(tx));
120123
size_t freeTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
121124

122125
// Calculate a fee on child transaction that will put the package just
123-
// below the min relay fee (assuming 1 child tx of the same size).
124-
CAmount feeToUse = minRelayTxFee.GetFee(2*freeTxSize) - 1;
126+
// below the block min tx fee (assuming 1 child tx of the same size).
127+
CAmount feeToUse = blockMinFeeRate.GetFee(2*freeTxSize) - 1;
125128

126129
tx.vin[0].prevout.hash = hashFreeTx;
127130
tx.vout[0].nValue = 5000000000LL - 1000 - 50000 - feeToUse;
@@ -158,7 +161,7 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey,
158161
// This tx can't be mined by itself
159162
tx.vin[0].prevout.hash = hashFreeTx2;
160163
tx.vout.resize(1);
161-
feeToUse = minRelayTxFee.GetFee(freeTxSize);
164+
feeToUse = blockMinFeeRate.GetFee(freeTxSize);
162165
tx.vout[0].nValue = 5000000000LL - 100000000 - feeToUse;
163166
uint256 hashLowFeeTx2 = tx.GetHash();
164167
mempool.addUnchecked(hashLowFeeTx2, entry.Fee(feeToUse).SpendsCoinbase(false).FromTx(tx));

0 commit comments

Comments
 (0)