v29.4-roots.1 · Commit 8: [PATCH 08/13] 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. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/test/util/setup_common.cpp
CHANGED
|
@@ -28,6 +28,7 @@
|
|
| 28 |
#include <node/peerman_args.h>
|
| 29 |
#include <node/warnings.h>
|
| 30 |
#include <noui.h>
|
|
|
|
| 31 |
#include <policy/fees.h>
|
| 32 |
#include <pow.h>
|
| 33 |
#include <random.h>
|
|
@@ -508,6 +509,8 @@ CMutableTransaction TestChain100Setup::CreateValidMempoolTransaction(CTransactio
|
|
| 508 |
|
| 509 |
std::vector<CTransactionRef> TestChain100Setup::PopulateMempool(FastRandomContext& det_rand, size_t num_transactions, bool submit)
|
| 510 |
{
|
|
|
|
|
|
|
| 511 |
std::vector<CTransactionRef> mempool_transactions;
|
| 512 |
std::deque<std::pair<COutPoint, CAmount>> unspent_prevouts;
|
| 513 |
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 |
}
|
| 545 |
if (submit) {
|
| 546 |
LOCK2(cs_main, m_node.mempool->cs);
|
|
|
|
| 547 |
LockPoints lp;
|
| 548 |
auto changeset = m_node.mempool->GetChangeSet();
|
| 549 |
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);
|
|
|
|
| 552 |
changeset->Apply();
|
| 553 |
}
|
| 554 |
--num_transactions;
|
|
@@ -584,7 +589,8 @@ void TestChain100Setup::MockMempoolMinFee(const CFeeRate& target_feerate)
|
|
| 584 |
auto changeset = m_node.mempool->GetChangeSet();
|
| 585 |
changeset->StageAddition(tx, /*fee=*/tx_fee,
|
| 586 |
/*time=*/0, /*entry_height=*/1, /*entry_sequence=*/0,
|
| 587 |
-
/*spends_coinbase=*/true, /*sigops_cost=*/1, lp);
|
|
|
|
| 588 |
changeset->Apply();
|
| 589 |
}
|
| 590 |
m_node.mempool->TrimToSize(0);
|
|
|
|
| 28 |
#include <node/peerman_args.h>
|
| 29 |
#include <node/warnings.h>
|
| 30 |
#include <noui.h>
|
| 31 |
+
#include <policy/coin_age_priority.h>
|
| 32 |
#include <policy/fees.h>
|
| 33 |
#include <pow.h>
|
| 34 |
#include <random.h>
|
|
|
|
| 509 |
|
| 510 |
std::vector<CTransactionRef> TestChain100Setup::PopulateMempool(FastRandomContext& det_rand, size_t num_transactions, bool submit)
|
| 511 |
{
|
| 512 |
+
auto& active_chainstate = m_node.chainman->ActiveChainstate();
|
| 513 |
+
const auto height = active_chainstate.m_chain.Height();
|
| 514 |
std::vector<CTransactionRef> mempool_transactions;
|
| 515 |
std::deque<std::pair<COutPoint, CAmount>> unspent_prevouts;
|
| 516 |
std::transform(m_coinbase_txns.begin(), m_coinbase_txns.end(), std::back_inserter(unspent_prevouts),
|
|
|
|
| 547 |
}
|
| 548 |
if (submit) {
|
| 549 |
LOCK2(cs_main, m_node.mempool->cs);
|
| 550 |
+
const auto coin_age = GetCoinAge(*ptx, active_chainstate.CoinsTip(), height + 1);
|
| 551 |
LockPoints lp;
|
| 552 |
auto changeset = m_node.mempool->GetChangeSet();
|
| 553 |
changeset->StageAddition(ptx, /*fee=*/(total_in - num_outputs * amount_per_output),
|
| 554 |
+
/*time=*/0, /*entry_height=*/height, /*entry_sequence=*/0,
|
| 555 |
+
coin_age,
|
| 556 |
+
/*spends_coinbase=*/false, /*extra_weight=*/0, /*sigops_cost=*/4, lp);
|
| 557 |
changeset->Apply();
|
| 558 |
}
|
| 559 |
--num_transactions;
|
|
|
|
| 589 |
auto changeset = m_node.mempool->GetChangeSet();
|
| 590 |
changeset->StageAddition(tx, /*fee=*/tx_fee,
|
| 591 |
/*time=*/0, /*entry_height=*/1, /*entry_sequence=*/0,
|
| 592 |
+
COIN_AGE_CACHE_ZERO,
|
| 593 |
+
/*spends_coinbase=*/true, /*extra_weight=*/0, /*sigops_cost=*/1, lp);
|
| 594 |
changeset->Apply();
|
| 595 |
}
|
| 596 |
m_node.mempool->TrimToSize(0);
|