Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 8: [PATCH 08/68] ci: restore Roots assurance on Core 30.3 interfaces

src/test/util/setup_common.cpp

Before: src/test/util/setup_common.cpp · After: src/test/util/setup_common.cpp

File metadata
index 5d839db5bcb599d4d462f45902a1b9fb55467fb1..8bbad50779046c551ca45855ad2ce2cab99e5a4a 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>
@@ -543,6 +544,8 @@ CMutableTransaction TestChain100Setup::CreateValidMempoolTransaction(CTransactio
543
544
 
544
545
  std::vector<CTransactionRef> TestChain100Setup::PopulateMempool(FastRandomContext& det_rand, size_t num_transactions, bool submit)
545
546
  {
547
+ auto& active_chainstate = m_node.chainman->ActiveChainstate();
548
+ const auto height = active_chainstate.m_chain.Height();
546
549
  std::vector<CTransactionRef> mempool_transactions;
547
550
  std::deque<std::pair<COutPoint, CAmount>> unspent_prevouts;
548
551
  std::transform(m_coinbase_txns.begin(), m_coinbase_txns.end(), std::back_inserter(unspent_prevouts),
@@ -579,11 +582,13 @@ std::vector<CTransactionRef> TestChain100Setup::PopulateMempool(FastRandomContex
579
582
  }
580
583
  if (submit) {
581
584
  LOCK2(cs_main, m_node.mempool->cs);
585
+ const auto coin_age = GetCoinAge(*ptx, active_chainstate.CoinsTip(), height + 1);
582
586
  LockPoints lp;
583
587
  auto changeset = m_node.mempool->GetChangeSet();
584
588
  changeset->StageAddition(ptx, /*fee=*/(total_in - num_outputs * amount_per_output),
585
- /*time=*/0, /*entry_height=*/1, /*entry_sequence=*/0,
586
- /*spends_coinbase=*/false, /*sigops_cost=*/4, lp);
589
+ /*time=*/0, /*entry_height=*/height, /*entry_sequence=*/0,
590
+ coin_age,
591
+ /*spends_coinbase=*/false, /*extra_weight=*/0, /*sigops_cost=*/4, lp);
587
592
  changeset->Apply();
588
593
  }
589
594
  --num_transactions;
@@ -619,7 +624,8 @@ void TestChain100Setup::MockMempoolMinFee(const CFeeRate& target_feerate)
619
624
  auto changeset = m_node.mempool->GetChangeSet();
620
625
  changeset->StageAddition(tx, /*fee=*/tx_fee,
621
626
  /*time=*/0, /*entry_height=*/1, /*entry_sequence=*/0,
622
- /*spends_coinbase=*/true, /*sigops_cost=*/1, lp);
627
+ COIN_AGE_CACHE_ZERO,
628
+ /*spends_coinbase=*/true, /*extra_weight=*/0, /*sigops_cost=*/1, lp);
623
629
  changeset->Apply();
624
630
  }
625
631
  m_node.mempool->TrimToSize(0);