mirror of https://github.com/bitcoin/bitcoin.git
[prep/util] help MockMempoolMinFee handle more precise feerates
Use a virtual size of 1000 to keep precision when using a feerate
(which is rounded to the nearest satoshi per kvb) that isn't just an
integer.
Github-Pull: #33106
Rebased-From: 457cfb61b5
This commit is contained in:
parent
4d809efeb9
commit
f25fc092ab
|
@ -41,6 +41,7 @@
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
#include <test/util/net.h>
|
#include <test/util/net.h>
|
||||||
#include <test/util/random.h>
|
#include <test/util/random.h>
|
||||||
|
#include <test/util/transaction_utils.h>
|
||||||
#include <test/util/txmempool.h>
|
#include <test/util/txmempool.h>
|
||||||
#include <txdb.h>
|
#include <txdb.h>
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
|
@ -582,6 +583,9 @@ void TestChain100Setup::MockMempoolMinFee(const CFeeRate& target_feerate)
|
||||||
CMutableTransaction mtx = CMutableTransaction();
|
CMutableTransaction mtx = CMutableTransaction();
|
||||||
mtx.vin.emplace_back(COutPoint{Txid::FromUint256(g_insecure_rand_ctx.rand256()), 0});
|
mtx.vin.emplace_back(COutPoint{Txid::FromUint256(g_insecure_rand_ctx.rand256()), 0});
|
||||||
mtx.vout.emplace_back(1 * COIN, GetScriptForDestination(WitnessV0ScriptHash(CScript() << OP_TRUE)));
|
mtx.vout.emplace_back(1 * COIN, GetScriptForDestination(WitnessV0ScriptHash(CScript() << OP_TRUE)));
|
||||||
|
// Set a large size so that the fee evaluated at target_feerate (which is usually in sats/kvB) is an integer.
|
||||||
|
// Otherwise, GetMinFee() may end up slightly different from target_feerate.
|
||||||
|
BulkTransaction(mtx, 4000);
|
||||||
const auto tx{MakeTransactionRef(mtx)};
|
const auto tx{MakeTransactionRef(mtx)};
|
||||||
LockPoints lp;
|
LockPoints lp;
|
||||||
// The new mempool min feerate is equal to the removed package's feerate + incremental feerate.
|
// The new mempool min feerate is equal to the removed package's feerate + incremental feerate.
|
||||||
|
|
Loading…
Reference in New Issue