5 #include <chainparams.h> 37 }
catch (
const std::ios_base::failure&) {
44 }
catch (
const std::ios_base::failure&) {
49 bool valid_mutable_tx =
true;
57 }
catch (
const std::ios_base::failure&) {
58 valid_mutable_tx =
false;
60 assert(valid_tx == valid_mutable_tx);
73 const bool is_standard_with_permit_bare_multisig =
IsStandardTx(tx, std::nullopt,
true, dust_relay_fee, reason);
74 const bool is_standard_without_permit_bare_multisig =
IsStandardTx(tx, std::nullopt,
false, dust_relay_fee, reason);
75 if (is_standard_without_permit_bare_multisig) {
76 assert(is_standard_with_permit_bare_multisig);
83 }
catch (
const std::runtime_error&) {
104 if (tx.
GetTotalSize() < 250
'000) { // Avoid high memory usage (with msan) due to json encoding 106 UniValue u{UniValue::VOBJ}; 107 TxToUniv(tx, /*block_hash=*/uint256::ZERO, /*entry=*/u); 110 UniValue u{UniValue::VOBJ}; 111 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.
const uint256 & GetWitnessHash() const
const uint256 & GetHash() const
static const int INIT_PROTO_VERSION
initial proto version, to be increased after version/verack negotiation
static constexpr unsigned int DUST_RELAY_TX_FEE
Min feerate for defining dust.
unsigned int GetLegacySigOpCount(const CTransaction &tx)
Auxiliary functions for transaction validation (ideally should not be exposed)
std::string ToString() const
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags=0)
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.
bool CheckTransaction(const CTransaction &tx, TxValidationState &state)
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.
#define Assert(val)
Identity function.