Bitcoin
|
Functions | |
CAmount | GetDustThreshold (const CTxOut &txout, const CFeeRate &dustRelayFeeIn) |
bool | IsDust (const CTxOut &txout, const CFeeRate &dustRelayFeeIn) |
bool | IsStandard (const CScript &scriptPubKey, txnouttype &whichType) |
bool | IsStandardTx (const CTransaction &tx, bool permit_bare_multisig, const CFeeRate &dust_relay_fee, std::string &reason) |
bool | AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs) |
bool | IsWitnessStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs) |
int64_t | GetVirtualTransactionSize (int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop) |
int64_t | GetVirtualTransactionSize (const CTransaction &tx, int64_t nSigOpCost, unsigned int bytes_per_sigop) |
int64_t | GetVirtualTransactionInputSize (const CTxIn &txin, int64_t nSigOpCost, unsigned int bytes_per_sigop) |
bool AreInputsStandard | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs | ||
) |
Check transaction inputs to mitigate two potential denial-of-service attacks:
Why bother? To avoid denial-of-service attacks; an attacker can submit a standard HASH... OP_EQUAL transaction, which will get accepted into blocks. The redemption script can be anything; an attacker could use a very expensive-to-check-upon-redemption script like: DUP CHECKSIG DROP ... repeated 100 times... OP_1
int64_t GetVirtualTransactionInputSize | ( | const CTxIn & | txin, |
int64_t | nSigOpCost, | ||
unsigned int | bytes_per_sigop | ||
) |
int64_t GetVirtualTransactionSize | ( | int64_t | nWeight, |
int64_t | nSigOpCost, | ||
unsigned int | bytes_per_sigop | ||
) |
Compute the virtual transaction size (weight reinterpreted as bytes).
int64_t GetVirtualTransactionSize | ( | const CTransaction & | tx, |
int64_t | nSigOpCost, | ||
unsigned int | bytes_per_sigop | ||
) |
bool IsStandard | ( | const CScript & | scriptPubKey, |
txnouttype & | whichType | ||
) |
bool IsStandardTx | ( | const CTransaction & | tx, |
bool | permit_bare_multisig, | ||
const CFeeRate & | dust_relay_fee, | ||
std::string & | reason | ||
) |
Check for standard transaction types
bool IsWitnessStandard | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs | ||
) |
Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size, 80bytes per witness stack element, 100 witness stack elements These limits are adequate for multi-signature up to n-of-100 using OP_CHECKSIG, OP_ADD, and OP_EQUAL,