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