14#include <boost/test/unit_test.hpp>
64 for (
int i = 0; i < 3; i++)
70 for (
int i = 0; i < 3; i++)
75 txChild[i].vin[0].prevout.n = i;
78 txChild[i].vout[0].nValue = 11000LL;
81 for (
int i = 0; i < 3; i++)
109 for (
int i = 0; i < 3; i++)
132 for (
int i = 0; i < 3; i++)
156 tx1.vout[0].nValue = 10 *
COIN;
164 tx2.vout[0].nValue = 10 *
COIN;
167 pool.TrimToSize(pool.DynamicMemoryUsage());
171 pool.TrimToSize(pool.DynamicMemoryUsage() * 3 / 4);
182 tx3.vout[0].nValue = 10 *
COIN;
185 pool.TrimToSize(pool.DynamicMemoryUsage() * 3 / 4);
200 tx4.vin[0].prevout.SetNull();
202 tx4.vin[1].prevout.SetNull();
206 tx4.vout[0].nValue = 10 *
COIN;
208 tx4.vout[1].nValue = 10 *
COIN;
214 tx5.vin[1].prevout.SetNull();
218 tx5.vout[0].nValue = 10 *
COIN;
220 tx5.vout[1].nValue = 10 *
COIN;
226 tx6.vin[1].prevout.SetNull();
230 tx6.vout[0].nValue = 10 *
COIN;
232 tx6.vout[1].nValue = 10 *
COIN;
242 tx7.vout[0].nValue = 10 *
COIN;
244 tx7.vout[1].nValue = 10 *
COIN;
256 pool.TrimToSize(pool.DynamicMemoryUsage() - 1);
263 if (!pool.exists(
tx5.GetHash()))
265 if (!pool.exists(
tx6.GetHash()))
280 std::vector<CTransactionRef> vtx;
286 pool.removeForBlock(vtx);
311 tx.
vin.resize(inputs.size());
313 for (
size_t i = 0; i < inputs.size(); ++i) {
314 tx.
vin[i].prevout.hash = inputs[i]->GetHash();
429 tyi =
make_tx({v}, i > 0 ? std::vector<CTransactionRef>{*
ty[i - 1]} : std::vector<CTransactionRef>{});
486 size_t ancestors, descendants;
535 auto txid{tx->GetHash()};
539 pool.AddUnbroadcastTx(txid);
542 pool.RemoveUnbroadcastTx(txid);
int64_t CAmount
Amount in satoshis (Can be negative)
constexpr CAmount COIN
The amount of satoshis in one BTC.
TryAddToMempool(pool, CTxMemPoolEntry(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.
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
CFeeRate GetMinFee() const
The minimum fee to get into the mempool, which may itself not be enough for larger-sized transactions...
void GetTransactionAncestry(const Txid &txid, size_t &ancestors, size_t &cluster_count, size_t *ancestorsize=nullptr, CAmount *ancestorfees=nullptr) const
Calculate the ancestor and cluster count for the given transaction.
static constexpr int ROLLING_FEE_HALFLIFE
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
void resize(size_type new_size)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_GT(excessive_headers.size(), MAX_HEADERS_SIZE)
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
@ REPLACED
Removed for replacement.
CTransactionRef make_tx(std::vector< CAmount > &&output_values, std::vector< CTransactionRef > &&inputs=std::vector< CTransactionRef >(), std::vector< uint32_t > &&input_indices=std::vector< uint32_t >())
static constexpr auto REMOVAL_REASON_DUMMY
BOOST_AUTO_TEST_CASE(MempoolLookupTest)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
constexpr unsigned int DEFAULT_INCREMENTAL_RELAY_FEE
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or rep...
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
A mutable version of CTransaction.
std::vector< CTxOut > vout
Txid GetHash() const
Compute the hash of this CMutableTransaction.
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const
TestMemPoolEntryHelper & Fee(CAmount _fee)
Testing setup that configures a complete environment.
std::unique_ptr< CTxMemPool > mempool
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.