27#include <validation.h>
42static std::vector<std::shared_ptr<CBlock>>
g_blocks;
59 uint256 internal_key{std::vector<uint8_t>(32, 1)};
171 setup.m_node.block_template_manager.reset();
172 setup.m_node.chainman.reset();
173 setup.m_node.notifications->m_shutdown_on_fatal_error =
false;
174 setup.m_make_chainman();
175 setup.CreateBlockTemplateManager();
176 setup.LoadVerifyActivateChainstate();
183 setup.m_node.validation_signals->SyncWithValidationInterfaceQueue();
192 Assert(
setup.m_node.chainman->ActiveChainstate().GetMempool()->size() == 0);
193 for (
size_t i = 1; i <= 10; i++) {
220 Assert(
setup.m_node.chainman->ActiveChainstate().GetMempool()->size() == i);
222 setup.m_node.chainman->ActiveChainstate().GetMempool()->PrioritiseTransaction(ctx.
GetHash(),
COIN);
288 tx.
vin[0].prevout.SetNull();
300 auto&
txin = tx.
vin.emplace_back();
328 txin.scriptWitness.stack.clear();
338 auto& txout = tx.
vout.emplace_back();
359 txout.scriptPubKey =
CScript();
int64_t CAmount
Amount in satoshis (Can be negative)
constexpr CAmount COIN
The amount of satoshis in one BTC.
const TestingSetup * g_setup
#define Assert(val)
Identity function.
std::vector< CTransactionRef > vtx
The block chain is a tree shaped structure starting with the genesis block at the root,...
CCoinsView that adds a memory cache for transactions to another CCoinsView.
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
static constexpr uint32_t CURRENT_VERSION
const std::vector< CTxOut > vout
const Txid & GetHash() const LIFETIMEBOUND
An input of a transaction.
An output of a transaction.
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
T ConsumeIntegralInRange(T min, T max)
std::optional< std::pair< XOnlyPubKey, bool > > CreateTapTweak(const uint256 *merkle_root) const
Construct a Taproot tweaked output point with this point as internal key.
static transaction_identifier FromUint256(const uint256 &id)
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
constexpr int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
uint256 ComputeTapleafHash(uint8_t leaf_version, std::span< const unsigned char > script)
Compute the BIP341 tapleaf hash from leaf version & script.
constexpr uint8_t TAPROOT_LEAF_TAPSCRIPT
is used externally by mining IPC clients, so it should only declare simple data definitions.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
std::vector< unsigned char > ToByteVector(const T &in)
constexpr auto MakeUCharSpan(const V &v) -> decltype(UCharSpanCast(std::span{v}))
Like the std::span constructor, but for (const) unsigned char member types only.
A mutable version of CTransaction.
std::vector< CTxOut > vout
Txid GetHash() const
Compute the hash of this CMutableTransaction.
Validation result for a transaction evaluated by MemPoolAccept (single or package).
std::vector< const char * > extra_args
Testing setup that configures a complete environment.
Block template creation options.
CScript coinbase_output_script
Script to put in the coinbase transaction.
std::unique_ptr< ChainstateManager > chainman
SeedRandomStateForTest(SeedRand::ZEROS)
uint32_t ConsumeSequence(FuzzedDataProvider &fuzzed_data_provider) noexcept
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
CMutableTransaction ConsumeTransaction(FuzzedDataProvider &fuzzed_data_provider, const std::optional< std::vector< Txid > > &prevout_txids, const int max_num_in, const int max_num_out) noexcept
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
COutPoint MineBlock(const NodeContext &node, const node::BlockCreateOptions &assembler_options)
Returns the generated coin.
@ ZEROS
Seed with a compile time constant of zeros.
static const std::vector< uint8_t > WITNESS_STACK_ELEM_OP_TRUE
static const CScript P2WSH_OP_TRUE
void SetMockTime(std::chrono::time_point< NodeClock, std::chrono::seconds > mock)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
FuzzedDataProvider & fuzzed_data_provider