5 #include <chainparams.h> 38 }
catch (
const std::ios_base::failure&) {
43 bool valid_mutable_tx =
true;
47 }
catch (
const std::ios_base::failure&) {
48 valid_mutable_tx =
false;
50 assert(valid_tx == valid_mutable_tx);
63 const bool is_standard_with_permit_bare_multisig =
IsStandardTx(tx, std::nullopt,
true, dust_relay_fee, reason);
64 const bool is_standard_without_permit_bare_multisig =
IsStandardTx(tx, std::nullopt,
false, dust_relay_fee, reason);
65 if (is_standard_without_permit_bare_multisig) {
66 assert(is_standard_with_permit_bare_multisig);
73 }
catch (
const std::runtime_error&) {
94 if (tx.
ComputeTotalSize() < 250
'000) { // Avoid high memory usage (with msan) due to json encoding 96 UniValue u{UniValue::VOBJ}; 97 TxToUniv(tx, /*block_hash=*/uint256::ZERO, /*entry=*/u); 100 UniValue u{UniValue::VOBJ}; 101 TxToUniv(tx, /*block_hash=*/uint256::ONE, /*entry=*/u);
bool IsStandardTx(const CTransaction &tx, const std::optional< unsigned > &max_datacarrier_bytes, bool permit_bare_multisig, const CFeeRate &dust_relay_fee, std::string &reason)
Check for standard transaction types.
void initialize_transaction()
constexpr deserialize_type deserialize
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
bool SignalsOptInRBF(const CTransaction &tx)
Check whether the sequence numbers on this transaction are signaling opt-in to replace-by-fee, according to BIP 125.
static int32_t GetTransactionWeight(const CTransaction &tx)
bool IsWitnessStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size...
CAmount GetValueOut() const
Minimal stream for reading from an existing byte array by std::span.
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check transaction inputs.
FUZZ_TARGET(transaction,.init=initialize_transaction)
Abstract view on the open txout dataset.
static constexpr unsigned int DUST_RELAY_TX_FEE
Min feerate for defining dust.
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
unsigned int GetLegacySigOpCount(const CTransaction &tx)
Auxiliary functions for transaction validation (ideally should not be exposed)
std::string EncodeHexTx(const CTransaction &tx)
std::string ToString() const
Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac...
static size_t RecursiveDynamicUsage(const CScript &script)
A mutable version of CTransaction.
bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
Check if transaction is final and can be included in a block with the specified height and time...
The basic transaction that is broadcasted on the network and contained in blocks. ...
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Seed with a compile time constant of zeros.
bool CheckTransaction(const CTransaction &tx, TxValidationState &state)
unsigned int ComputeTotalSize() const
Calculate the total transaction size in bytes, including witness data.
const Wtxid & GetWitnessHash() const LIFETIMEBOUND
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.
#define Assert(val)
Identity function.
const Txid & GetHash() const LIFETIMEBOUND
static constexpr TransactionSerParams TX_WITH_WITNESS