v29.4-roots.3 · Commit 8: [PATCH 08/30] ci: restore assurance and isolate Core fixtures
src/test/util/setup_common.cpp
Before: src/test/util/setup_common.cpp · After: src/test/util/setup_common.cpp
File metadata
index 29327d461ba24e483d7e50e47b4ae204d27430e4..0d75262982752f3f5a6ec14b8b81d0dfd74ca6f1 100644
Download original patch · Release notes
Diff rows 1–39 of 39. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
src/test/util/setup_common.cpp
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
#include <node/peerman_args.h>
|
|
29
29
|
#include <node/warnings.h>
|
|
30
30
|
#include <noui.h>
|
|
31
|
+
#include <policy/coin_age_priority.h>
|
|
31
32
|
#include <policy/fees.h>
|
|
32
33
|
#include <pow.h>
|
|
33
34
|
#include <random.h>
|
|
@@ -508,6 +509,8 @@ CMutableTransaction TestChain100Setup::CreateValidMempoolTransaction(CTransactio
|
|
|
508
509
|
|
|
509
510
|
std::vector<CTransactionRef> TestChain100Setup::PopulateMempool(FastRandomContext& det_rand, size_t num_transactions, bool submit)
|
|
510
511
|
{
|
|
512
|
+
auto& active_chainstate = m_node.chainman->ActiveChainstate();
|
|
513
|
+
const auto height = active_chainstate.m_chain.Height();
|
|
511
514
|
std::vector<CTransactionRef> mempool_transactions;
|
|
512
515
|
std::deque<std::pair<COutPoint, CAmount>> unspent_prevouts;
|
|
513
516
|
std::transform(m_coinbase_txns.begin(), m_coinbase_txns.end(), std::back_inserter(unspent_prevouts),
|
|
@@ -544,11 +547,13 @@ std::vector<CTransactionRef> TestChain100Setup::PopulateMempool(FastRandomContex
|
|
|
544
547
|
}
|
|
545
548
|
if (submit) {
|
|
546
549
|
LOCK2(cs_main, m_node.mempool->cs);
|
|
550
|
+
const auto coin_age = GetCoinAge(*ptx, active_chainstate.CoinsTip(), height + 1);
|
|
547
551
|
LockPoints lp;
|
|
548
552
|
auto changeset = m_node.mempool->GetChangeSet();
|
|
549
553
|
changeset->StageAddition(ptx, /*fee=*/(total_in - num_outputs * amount_per_output),
|
|
550
|
-
/*time=*/0, /*entry_height=*/1, /*entry_sequence=*/0,
|
|
551
|
-
/*spends_coinbase=*/false, /*sigops_cost=*/4, lp);
|
|
554
|
+
/*time=*/0, /*entry_height=*/height, /*entry_sequence=*/0,
|
|
555
|
+
coin_age,
|
|
556
|
+
/*spends_coinbase=*/false, /*extra_weight=*/0, /*sigops_cost=*/4, lp);
|
|
552
557
|
changeset->Apply();
|
|
553
558
|
}
|
|
554
559
|
--num_transactions;
|
|
@@ -584,7 +589,8 @@ void TestChain100Setup::MockMempoolMinFee(const CFeeRate& target_feerate)
|
|
|
584
589
|
auto changeset = m_node.mempool->GetChangeSet();
|
|
585
590
|
changeset->StageAddition(tx, /*fee=*/tx_fee,
|
|
586
591
|
/*time=*/0, /*entry_height=*/1, /*entry_sequence=*/0,
|
|
587
|
-
/*spends_coinbase=*/true, /*sigops_cost=*/1, lp);
|
|
592
|
+
COIN_AGE_CACHE_ZERO,
|
|
593
|
+
/*spends_coinbase=*/true, /*extra_weight=*/0, /*sigops_cost=*/1, lp);
|
|
588
594
|
changeset->Apply();
|
|
589
595
|
}
|
|
590
596
|
m_node.mempool->TrimToSize(0);
|