6#include <chainparams.h>
16#include <boost/test/unit_test.hpp>
25 tx.
vin[0].scriptSig.resize(10);
27 tx.
vout[0].nValue = 42;
39 block.
nBits = 0x207fffff;
42 tx.
vin[0].prevout.n = 0;
46 for (
size_t i = 0; i < tx.
vin.size(); i++) {
48 tx.
vin[i].prevout.n = 0;
92 size_t poolSize = pool.
size();
106 partialBlock.
FillBlock(block2, {block.vtx[2]},
true);
193 partialBlock.
FillBlock(block2, {block.vtx[1]},
true);
209 txhash = block.vtx[2]->GetHash();
262 txhash = block.vtx[1]->GetHash();
281 block.
nBits = 0x207fffff;
303 std::vector<CTransactionRef> vtx_missing;
318 mtx.vin[0].prevout.n = 0;
322 std::vector<std::pair<Wtxid, CTransactionRef>> extra_txn;
323 extra_txn.resize(10);
329 for (
const auto &block_tx : block.
vtx) {
346 extra_txn[0] = {non_block_tx->GetWitnessHash(), non_block_tx};
348 extra_txn[1] = {block.
vtx[1]->GetWitnessHash(), block.
vtx[1]};
405 req0.
indexes[1] = 0x10000 - 0x7000 - 2;
421 }
catch(std::ios_base::failure &) {
TryAddToMempool(pool, CTxMemPoolEntry(tx, fee, 0, 1, 0, false, 4, lp))
std::string ToString(const T &t)
Locale-independent version of std::to_string.
static CBlock BuildBlockTestCase(FastRandomContext &ctx)
BOOST_AUTO_TEST_CASE(SimpleRoundTripTest)
const std::vector< std::pair< Wtxid, CTransactionRef > > empty_extra_txn
constexpr long SHARED_TX_OFFSET
static CMutableTransaction BuildTransactionTestCase()
const CChainParams & Params()
Return the currently selected parameters.
#define Assert(val)
Identity function.
std::vector< uint16_t > indexes
uint64_t GetShortID(const Wtxid &wtxid) const
std::vector< CTransactionRef > vtx
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
CTransactionRef get(const Txid &hash) const
void check(const CCoinsViewCache &active_coins_tip, int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(voi removeRecursive)(const CTransaction &tx, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs)
If sanity-checking is turned on, check makes sure the pool is consistent (does not contain two transa...
unsigned long size() const
Double ended buffer combining vector and stream-like interfaces.
ReadStatus FillBlock(CBlock &block, const std::vector< CTransactionRef > &vtx_missing, bool segwit_active)
bool IsTxAvailable(size_t index) const
ReadStatus InitData(const CBlockHeaderAndShortTxIDs &cmpctblock, const std::vector< std::pair< Wtxid, CTransactionRef > > &extra_txn)
uint256 rand256() noexcept
generate a random uint256.
TestHeaderAndShortIDs(const CBlockHeaderAndShortTxIDs &orig)
std::vector< uint64_t > shorttxids
std::vector< PrefilledTransaction > prefilledtxn
TestHeaderAndShortIDs(const CBlock &block, FastRandomContext &ctx)
uint64_t GetShortID(const Wtxid &txhash) const
SERIALIZE_METHODS(TestHeaderAndShortIDs, obj)
std::string ToString() const
static transaction_identifier FromUint256(const uint256 &id)
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
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()
@ REPLACED
Removed for replacement.
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params ¶ms)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
void WriteCompactSize(SizeComputer &os, uint64_t nSize)
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class.
A mutable version of CTransaction.
std::vector< CTxOut > vout
Identical to TestingSetup, but chain set to regtest.
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const
transaction_identifier< true > Wtxid
Wtxid commits to all transaction fields including the witness.
transaction_identifier< false > Txid
Txid commits to all transaction fields except the witness.
BOOST_CHECK_NE(OneL.ToString(), ArrayToString(ZeroArray, 32))