Skip to content

Commit 0679e0b

Browse files
committed
QA: Properly initialize coin-age priority on transactions made by TestChain100Setup::PopulateMempool
1 parent fe37e75 commit 0679e0b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/util/setup_common.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <node/peerman_args.h>
3131
#include <node/warnings.h>
3232
#include <noui.h>
33+
#include <policy/coin_age_priority.h>
3334
#include <policy/fees.h>
3435
#include <pow.h>
3536
#include <random.h>
@@ -520,6 +521,8 @@ CMutableTransaction TestChain100Setup::CreateValidMempoolTransaction(CTransactio
520521

521522
std::vector<CTransactionRef> TestChain100Setup::PopulateMempool(FastRandomContext& det_rand, size_t num_transactions, bool submit)
522523
{
524+
auto& active_chainstate = m_node.chainman->ActiveChainstate();
525+
const auto height = active_chainstate.m_chain.Height();
523526
std::vector<CTransactionRef> mempool_transactions;
524527
std::deque<std::pair<COutPoint, CAmount>> unspent_prevouts;
525528
std::transform(m_coinbase_txns.begin(), m_coinbase_txns.end(), std::back_inserter(unspent_prevouts),
@@ -557,9 +560,11 @@ std::vector<CTransactionRef> TestChain100Setup::PopulateMempool(FastRandomContex
557560
if (submit) {
558561
LOCK2(cs_main, m_node.mempool->cs);
559562
LockPoints lp;
563+
CAmount in_chain_input_value;
564+
double dPriority = GetPriority(*ptx, active_chainstate.CoinsTip(), height + 1, in_chain_input_value);
560565
m_node.mempool->addUnchecked(CTxMemPoolEntry(ptx, /*fee=*/(total_in - num_outputs * amount_per_output),
561-
/*time=*/0, /*entry_priority=*/0, /*entry_height=*/1, /*entry_sequence=*/0,
562-
/*in_chain_input_value=*/0,
566+
/*time=*/0, /*entry_priority=*/ dPriority, /*entry_height=*/ height, /*entry_sequence=*/0,
567+
in_chain_input_value,
563568
/*spends_coinbase=*/false, /*sigops_cost=*/4, lp));
564569
}
565570
--num_transactions;

0 commit comments

Comments
 (0)