6 #include <chainparams.h> 15 #include <boost/test/unit_test.hpp> 24 tx.
vin[0].scriptSig.resize(10);
26 tx.
vout[0].nValue = 42;
38 block.
nBits = 0x207fffff;
41 tx.
vin[0].prevout.n = 0;
45 for (
size_t i = 0; i < tx.
vin.size(); i++) {
47 tx.
vin[i].prevout.n = 0;
91 size_t poolSize = pool.
size();
208 txhash = block.
vtx[2]->GetHash();
261 txhash = block.
vtx[1]->GetHash();
280 block.
nBits = 0x207fffff;
302 std::vector<CTransactionRef> vtx_missing;
317 mtx.
vin[0].prevout.n = 0;
321 std::vector<CTransactionRef> extra_txn;
322 extra_txn.resize(10);
328 for (
const auto &block_tx : block.
vtx) {
329 BOOST_CHECK_NE(block_tx->GetHash(), non_block_tx->GetHash());
345 extra_txn[0] = non_block_tx;
347 extra_txn[1] = block.
vtx[1];
404 req0.
indexes[1] = 0x10000 - 0x7000 - 2;
420 }
catch(std::ios_base::failure &) {
std::shared_ptr< const CTransaction > CTransactionRef
ReadStatus FillBlock(CBlock &block, const std::vector< CTransactionRef > &vtx_missing)
std::vector< uint16_t > indexes
static CMutableTransaction BuildTransactionTestCase()
unsigned long size() const
BOOST_AUTO_TEST_CASE(SimpleRoundTripTest)
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const
SERIALIZE_METHODS(TestHeaderAndShortIDs, obj)
void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs)
uint64_t GetShortID(const Wtxid &txhash) const
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class...
std::unique_ptr< CTxMemPool > mempool
std::vector< uint64_t > shorttxids
const std::vector< CTransactionRef > empty_extra_txn
std::vector< PrefilledTransaction > prefilledtxn
constexpr long SHARED_TX_OFFSET
Double ended buffer combining vector and stream-like interfaces.
void WriteCompactSize(SizeComputer &os, uint64_t nSize)
BOOST_AUTO_TEST_SUITE_END()
TestHeaderAndShortIDs(const CBlockHeaderAndShortTxIDs &orig)
static CBlock BuildBlockTestCase(FastRandomContext &ctx)
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
std::string ToString() const
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 uint256 InsecureRand256()
std::vector< CTxOut > vout
TestHeaderAndShortIDs(const CBlock &block, FastRandomContext &ctx)
ReadStatus InitData(const CBlockHeaderAndShortTxIDs &cmpctblock, const std::vector< CTransactionRef > &extra_txn)
static CTransactionRef MakeTransactionRef(Tx &&txIn)
void check(const CCoinsViewCache &active_coins_tip, int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(void addUnchecked(const CTxMemPoolEntry &entry) EXCLUSIVE_LOCKS_REQUIRED(cs
If sanity-checking is turned on, check makes sure the pool is consistent (does not contain two transa...
std::vector< CTransactionRef > vtx
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
#define BOOST_CHECK_EQUAL(v1, v2)
const CChainParams & Params()
Return the currently selected parameters.
static transaction_identifier FromUint256(const uint256 &id)
bool IsTxAvailable(size_t index) const
uint256 rand256() noexcept
generate a random uint256.
A mutable version of CTransaction.
CTransactionRef get(const uint256 &hash) const
const Consensus::Params & GetConsensus() const
Identical to TestingSetup, but chain set to regtest.
uint64_t rand64() noexcept
Generate a random 64-bit integer.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it...
#define Assert(val)
Identity function.
uint64_t GetShortID(const Wtxid &wtxid) const
#define BOOST_CHECK(expr)
transaction_identifier represents the two canonical transaction identifier types (txid, wtxid).