30std::deque<COutPoint> g_available_coins;
31void initialize_miner()
33 static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
34 g_setup = testing_setup.get();
35 for (uint32_t i = 0; i < uint32_t{100}; ++i) {
49 std::vector<COutPoint> outpoints;
50 std::deque<COutPoint> available_coins = g_available_coins;
58 for (
size_t n{0}; n < num_inputs; ++n) {
59 auto prevout = available_coins.front();
61 available_coins.pop_front();
63 for (uint32_t n{0}; n < num_outputs; ++n) {
73 for (uint32_t n{0}; n < num_outputs; ++n) {
75 available_coins.emplace_back(tx->GetHash(), n);
81 outpoints.emplace_back(tx->GetHash(),
87 if (outpoint.has_value() && std::find(outpoints.begin(), outpoints.end(), *outpoint) == outpoints.end()) {
88 outpoints.push_back(*outpoint);
95 std::optional<CAmount> total_bumpfee;
99 assert(mini_miner.IsReadyToCalculate());
100 const auto bump_fees = mini_miner.CalculateBumpFees(target_feerate);
101 for (
const auto& outpoint : outpoints) {
102 auto it = bump_fees.find(outpoint);
103 assert(it != bump_fees.end());
105 sum_fees += it->second;
107 assert(!mini_miner.IsReadyToCalculate());
111 assert(mini_miner.IsReadyToCalculate());
112 total_bumpfee = mini_miner.CalculateTotalBumpFees(target_feerate);
113 assert(total_bumpfee.has_value());
114 assert(!mini_miner.IsReadyToCalculate());
117 assert (sum_fees >= *total_bumpfee);
static constexpr CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
bool MoneyRange(const CAmount &nValue)
int64_t CAmount
Amount in satoshis (Can be negative)
TryAddToMempool(pool, CTxMemPoolEntry(TxGraph::Ref(), tx, fee, 0, 1, 0, false, 4, lp))
#define Assert(val)
Identity function.
Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac.
Serialized script, used inside transaction inputs and outputs.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
T ConsumeIntegralInRange(T min, T max)
A minimal version of BlockAssembler, using the same ancestor set scoring algorithm.
static transaction_identifier FromUint256(const uint256 &id)
static const uint256 ZERO
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
is a home for public enum and struct type definitions that are used internally by node code,...
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
A mutable version of CTransaction.
std::vector< CTxOut > vout
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const
TestMemPoolEntryHelper & Fee(CAmount _fee)
Testing setup that configures a complete environment.
Options struct containing options for constructing a CTxMemPool.
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
@ ZEROS
Seed with a compile time constant of zeros.
static const CScript P2WSH_OP_TRUE
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
FuzzedDataProvider & fuzzed_data_provider