5 #include <chainparams.h> 38 }
catch (
const std::ios_base::failure&) {
43 bool valid_mutable_tx =
true;
48 }
catch (
const std::ios_base::failure&) {
49 valid_mutable_tx =
false;
51 assert(valid_tx == valid_mutable_tx);
64 const bool is_standard_with_permit_bare_multisig =
IsStandardTx(tx, std::nullopt,
true, dust_relay_fee, reason);
65 const bool is_standard_without_permit_bare_multisig =
IsStandardTx(tx, std::nullopt,
false, dust_relay_fee, reason);
66 if (is_standard_without_permit_bare_multisig) {
67 assert(is_standard_with_permit_bare_multisig);
74 }
catch (
const std::runtime_error&) {
95 if (tx.
GetTotalSize() < 250
'000) { // Avoid high memory usage (with msan) due to json encoding 97 UniValue u{UniValue::VOBJ}; 98 TxToUniv(tx, /*block_hash=*/uint256::ZERO, /*entry=*/u); 101 UniValue u{UniValue::VOBJ}; 102 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
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check transaction inputs to mitigate two potential denial-of-service attacks:
FUZZ_TARGET(transaction,.init=initialize_transaction)
Abstract view on the open txout dataset.
Double ended buffer combining vector and stream-like interfaces.
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.
std::string EncodeHexTx(const CTransaction &tx)
unsigned int GetLegacySigOpCount(const CTransaction &tx)
Auxiliary functions for transaction validation (ideally should not be exposed)
std::string ToString() const
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
static size_t RecursiveDynamicUsage(const CScript &script)
A mutable version of CTransaction.
unsigned int GetTotalSize() const
Get the total transaction size in bytes, including witness data.
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)
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