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