Bitcoin ABC 0.30.7
P2P Digital Currency
|
#include <coins.h>
#include <common/system.h>
#include <policy/policy.h>
#include <script/interpreter.h>
Go to the source code of this file.
Functions | |
Amount | GetDustThreshold (const CTxOut &txout, const CFeeRate &dustRelayFeeIn) |
bool | IsDust (const CTxOut &txout, const CFeeRate &dustRelayFeeIn) |
bool | IsStandard (const CScript &scriptPubKey, const std::optional< unsigned > &max_datacarrier_bytes, TxoutType &whichType) |
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. More... | |
bool | AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs, uint32_t flags) |
Check transaction inputs to mitigate two potential denial-of-service attacks: More... | |
int64_t | GetVirtualTransactionSize (int64_t nSize, int64_t nSigChecks, unsigned int bytes_per_sigCheck) |
Compute the virtual transaction size (size, or more if sigChecks are too dense). More... | |
int64_t | GetVirtualTransactionSize (const CTransaction &tx, int64_t nSigChecks, unsigned int bytes_per_sigCheck) |
int64_t | GetVirtualTransactionInputSize (const CTxIn &txin, int64_t nSigChecks, unsigned int bytes_per_sigCheck) |
bool AreInputsStandard | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs, | ||
uint32_t | flags | ||
) |
Check transaction inputs to mitigate two potential denial-of-service attacks:
Check for standard transaction types.
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
Definition at line 145 of file policy.cpp.
"Dust" is defined in terms of dustRelayFee, which has units satoshis-per-kilobyte. If you'd pay more than 1/3 in fees to spend something, then we consider it dust. A typical spendable txout is 34 bytes big, and will need a CTxIn of at least 148 bytes to spend: so dust is a spendable txout less than 546*dustRelayFee/1000 (in satoshis).
Definition at line 14 of file policy.cpp.
int64_t GetVirtualTransactionInputSize | ( | const CTxIn & | txin, |
int64_t | nSigChecks, | ||
unsigned int | bytes_per_sigCheck | ||
) |
Definition at line 176 of file policy.cpp.
int64_t GetVirtualTransactionSize | ( | const CTransaction & | tx, |
int64_t | nSigChecks, | ||
unsigned int | bytes_per_sigCheck | ||
) |
int64_t GetVirtualTransactionSize | ( | int64_t | nSize, |
int64_t | nSigChecks, | ||
unsigned int | bytes_per_sigCheck | ||
) |
Compute the virtual transaction size (size, or more if sigChecks are too dense).
Definition at line 165 of file policy.cpp.
Definition at line 34 of file policy.cpp.
bool IsStandard | ( | const CScript & | scriptPubKey, |
const std::optional< unsigned > & | max_datacarrier_bytes, | ||
TxoutType & | whichType | ||
) |
Definition at line 38 of file policy.cpp.
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.
Definition at line 66 of file policy.cpp.