10#include <validation.h>
14#include <boost/test/unit_test.hpp>
23 CAmount nPreviousSubsidy = nInitialSubsidy * 2;
25 for (
int nHalvings = 0; nHalvings < maxHalvings; nHalvings++) {
26 int nHeight = nHalvings * consensusParams.nSubsidyHalvingInterval;
30 nPreviousSubsidy = nSubsidy;
57 nSum += nSubsidy * 1000;
66 signet_argsman.
ForceSetArg(
"-signetchallenge",
"51");
69 BOOST_CHECK(signet_params->GetConsensus().signet_challenge == std::vector<uint8_t>{OP_TRUE});
85 std::vector<uint8_t> witness_commitment_section_141{0xaa, 0x21, 0xa9, 0xed};
86 for (
int i = 0; i < 32; ++i) {
87 witness_commitment_section_141.push_back(0xff);
95 std::vector<uint8_t> witness_commitment_section_325{0xec, 0xc7, 0xda, 0xa2};
96 cb.
vout.at(0).scriptPubKey =
CScript{} <<
OP_RETURN << witness_commitment_section_141 << witness_commitment_section_325;
102 witness_commitment_section_325.push_back(0x01);
103 witness_commitment_section_325.push_back(0x51);
104 cb.
vout.at(0).scriptPubKey =
CScript{} <<
OP_RETURN << witness_commitment_section_141 << witness_commitment_section_325;
110 witness_commitment_section_325.push_back(0x00);
111 cb.
vout.at(0).scriptPubKey =
CScript{} <<
OP_RETURN << witness_commitment_section_141 << witness_commitment_section_325;
117 witness_commitment_section_325.push_back(0x00);
118 cb.
vout.at(0).scriptPubKey =
CScript{} <<
OP_RETURN << witness_commitment_section_141 << witness_commitment_section_325;
131 std::vector<int> bad_heights{0, 100, 111, 115, 209, 211};
133 for (
auto empty : bad_heights) {
139 BOOST_CHECK_EQUAL(out110.hash_serialized.ToString(),
"1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618");
143 BOOST_CHECK_EQUAL(out210.hash_serialized.ToString(),
"51c8d11d8b5c1de51543c579736e786aa2736206d1e11e627568029ce092cf62");
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 std::string &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)
static const std::string REGTEST
static const std::string SIGNET
static const std::string MAIN
Chain name strings.
std::vector< CTransactionRef > vtx
Serialized script, used inside transaction inputs and outputs.
static std::optional< SignetTxs > Create(const CBlock &block, const CScript &challenge)
BOOST_AUTO_TEST_SUITE_END()
Transaction validation functions.
#define BOOST_FIXTURE_TEST_SUITE(a, b)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
static CTransactionRef MakeTransactionRef(Tx &&txIn)
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.
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams)
const AssumeutxoData * ExpectedAssumeutxo(const int height, const CChainParams &chainparams)
Return the expected assumeutxo value for a given height, if one exists.
static void TestBlockSubsidyHalvings(const Consensus::Params &consensusParams)
BOOST_AUTO_TEST_CASE(block_subsidy_test)