6#include <chainparams.h>
16#include <boost/test/unit_test.hpp>
25 tx.
vin[0].scriptSig.resize(10);
27 tx.
vout[0].nValue = 42;
36 block.
vtx[0] = MakeTransactionRef(tx);
39 block.
nBits = 0x207fffff;
42 tx.
vin[0].prevout.n = 0;
43 block.
vtx[1] = MakeTransactionRef(tx);
46 for (
size_t i = 0; i < tx.
vin.size(); i++) {
48 tx.
vin[i].prevout.n = 0;
50 block.
vtx[2] = MakeTransactionRef(tx);
92 size_t poolSize = pool.
size();
106 partialBlock.
FillBlock(block2, {block.vtx[2]},
true);
200 partialBlock.
FillBlock(block2, {block.vtx[1]},
true);
216 txhash = block.vtx[2]->GetHash();
269 txhash = block.vtx[1]->GetHash();
285 block.
vtx[0] = MakeTransactionRef(std::move(coinbase));
288 block.
nBits = 0x207fffff;
310 std::vector<CTransactionRef> vtx_missing;
325 mtx.vin[0].prevout.n = 0;
326 const CTransactionRef non_block_tx = MakeTransactionRef(std::move(mtx));
332 block.
vtx.push_back(MakeTransactionRef(std::move(mtx)));
336 std::vector<std::pair<Wtxid, CTransactionRef>> extra_txn;
337 extra_txn.resize(10);
343 for (
const auto &block_tx : block.
vtx) {
360 extra_txn[0] = {non_block_tx->GetWitnessHash(), non_block_tx};
362 extra_txn[1] = {block.
vtx[1]->GetWitnessHash(), block.
vtx[1]};
371 extra_txn[2] = {block.
vtx[2]->GetWitnessHash(), non_block_tx};
380 extra_txn[3] = {block.
vtx[1]->GetWitnessHash(), non_block_tx};
389 extra_txn[4] = {block.
vtx[2]->GetWitnessHash(), block.
vtx[2]};
390 extra_txn[5] = {block.
vtx[1]->GetWitnessHash(), block.
vtx[1]};
447 req0.
indexes[1] = 0x10000 - 0x7000 - 2;
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)
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 ...
void check(const CCoinsViewCache &active_coins_tip, int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(void 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...
CTransactionRef get(const Txid &hash) const
Return a mempool transaction with a given hash.
unsigned long size() const
Double ended buffer combining vector and stream-like interfaces.
FastRandomContext(bool fDeterministic=false) noexcept
Construct a FastRandomContext with GetRandHash()-based entropy (or zero key if fDeterministic).
BOOST_CHECK_EXCEPTION predicates to check the specific validation error.
PartiallyDownloadedBlock(CTxMemPool *poolIn)
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()
BOOST_CHECK_EXCEPTION(req.LoadBody(reader), std::runtime_error, HasReason{"Cannot parse Content-Length value"})
BOOST_AUTO_TEST_CASE(ipc_tests)
@ 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.
std::shared_ptr< const CTransaction > CTransactionRef
void WriteCompactSize(SizeComputer &os, uint64_t nSize)
A mutable version of CTransaction.
std::vector< CTxOut > vout
Identical to TestingSetup, but chain set to regtest.
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const
PartiallyDownloadedBlock(CTxMemPool *poolIn)
size_t GetExtraCount() const
size_t GetMempoolCount() 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))