5#include <chainparams.h>
14#include <validation.h>
20#include <boost/test/unit_test.hpp>
92 for (
int i = 0; i < 32; ++i) {
137 std::vector<int>
bad_heights{0, 100, 111, 115, 209, 211};
140 const auto out = params->AssumeutxoForHeight(empty);
144 const auto out110 = *params->AssumeutxoForHeight(110);
145 BOOST_CHECK_EQUAL(
out110.hash_serialized.ToString(),
"b952555c8ab81fec46f3d4253b7af256d766ceb39fb7752b9d18cdf4a0141327");
148 const auto out110_2 = *params->AssumeutxoForBlockhash(
uint256{
"6affe030b7965ab538f820a56ef56c8149b7dc1d1c144af57113be080db7c397"});
149 BOOST_CHECK_EQUAL(
out110_2.hash_serialized.ToString(),
"b952555c8ab81fec46f3d4253b7af256d766ceb39fb7752b9d18cdf4a0141327");
178 coinbase.vin[0].scriptWitness.stack.resize(1);
179 coinbase.vin[0].scriptWitness.stack[0] = std::vector<unsigned char>(32, 0x00);
185 coinbase.vout[0].scriptPubKey[1] = 0x24;
186 coinbase.vout[0].scriptPubKey[2] = 0xaa;
187 coinbase.vout[0].scriptPubKey[3] = 0x21;
188 coinbase.vout[0].scriptPubKey[4] = 0xa9;
189 coinbase.vout[0].scriptPubKey[5] = 0xed;
196 assert(!block.
vtx.empty() && block.
vtx[0]->IsCoinBase() && !block.
vtx[0]->vout.empty());
235 block.
vtx[1] = block.
vtx[0];
249 mtx.vout[0].scriptPubKey.resize(4);
282 BOOST_CHECK(
DecodeHexTx(
tx3,
"cdaf22d00002c6a7f848f8ae4d30054e61dcf3303d6fe01d282163341f06feecc10032b3160fcab87bdfe3ecfb769206ef2d991b92f8a268e423a6ef4d485f06",
true,
false));
315 mtx.vin[0].scriptWitness.stack.resize(1);
316 mtx.vin[0].scriptWitness.stack[0] = {0};
337 assert(!
mtx.vin[0].scriptWitness.stack[0].empty());
338 ++
mtx.vin[0].scriptWitness.stack[0][0];
355 mtx.vin[0].scriptWitness.stack.resize(0);
bool MoneyRange(const CAmount &nValue)
int64_t CAmount
Amount in satoshis (Can be negative)
static constexpr CAmount COIN
The amount of satoshis in one BTC.
std::unique_ptr< const CChainParams > CreateChainParams(const ArgsManager &args, const ChainType chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
const CChainParams & Params()
Return the currently selected parameters.
void ForceSetArg(const std::string &strArg, const std::string &strValue)
bool m_checked_merkle_root
std::vector< CTransactionRef > vtx
bool m_checked_witness_commitment
A hasher class for Bitcoin's 256-bit hash (double SHA-256).
void Finalize(std::span< unsigned char > output)
CHash256 & Write(std::span< const unsigned char > input)
Serialized script, used inside transaction inputs and outputs.
A writer stream (for serialization) that computes a 256-bit hash.
void write(std::span< const std::byte > src)
static std::optional< SignetTxs > Create(const CBlock &block, const CScript &challenge)
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
uint256 BlockWitnessMerkleRoot(const CBlock &block)
static constexpr size_t MINIMUM_WITNESS_COMMITMENT
Minimum size of a witness commitment structure.
bool DecodeHexTx(CMutableTransaction &tx, const std::string &hex_tx, bool try_no_witness, bool try_witness)
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
Transaction validation functions.
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
static constexpr TransactionSerParams TX_NO_WITNESS
static CTransactionRef MakeTransactionRef(Tx &&txIn)
uint64_t GetSerializeSize(const T &t)
bool CheckSignetBlockSolution(const CBlock &block, const Consensus::Params &consensusParams)
Extract signature and check whether a block has a valid solution.
A mutable version of CTransaction.
std::vector< CTxOut > vout
Parameters that influence chain consensus.
int nSubsidyHalvingInterval
Testing setup that configures a complete environment.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
bool IsBlockMutated(const CBlock &block, bool check_witness_root)
Check if a block has been mutated (with respect to its merkle root and witness commitments).
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams)
static void TestBlockSubsidyHalvings(const Consensus::Params &consensusParams)
BOOST_AUTO_TEST_CASE(block_subsidy_test)