Changeset View
Changeset View
Standalone View
Standalone View
src/policy/policy.cpp
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | if (whichType == TX_NONSTANDARD) { | ||||
if (scriptPubKey.size() > nMaxDatacarrierBytes) { | if (scriptPubKey.size() > nMaxDatacarrierBytes) { | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool IsStandardTx(const CTransaction &tx, std::string &reason) { | bool IsStandardTx(const CTransaction &tx, bool permit_bare_multisig, | ||||
const CFeeRate &dust_relay_fee, std::string &reason) { | |||||
if (tx.nVersion > CTransaction::MAX_STANDARD_VERSION || tx.nVersion < 1) { | if (tx.nVersion > CTransaction::MAX_STANDARD_VERSION || tx.nVersion < 1) { | ||||
reason = "version"; | reason = "version"; | ||||
return false; | return false; | ||||
} | } | ||||
// Extremely large transactions with lots of inputs can cost the network | // Extremely large transactions with lots of inputs can cost the network | ||||
// almost as much to process as they cost the sender in fees, because | // almost as much to process as they cost the sender in fees, because | ||||
// computing signature hashes is O(ninputs*txsize). Limiting transactions | // computing signature hashes is O(ninputs*txsize). Limiting transactions | ||||
Show All 20 Lines | bool IsStandardTx(const CTransaction &tx, bool permit_bare_multisig, | ||||
for (const CTxOut &txout : tx.vout) { | for (const CTxOut &txout : tx.vout) { | ||||
if (!::IsStandard(txout.scriptPubKey, whichType)) { | if (!::IsStandard(txout.scriptPubKey, whichType)) { | ||||
reason = "scriptpubkey"; | reason = "scriptpubkey"; | ||||
return false; | return false; | ||||
} | } | ||||
if (whichType == TX_NULL_DATA) { | if (whichType == TX_NULL_DATA) { | ||||
nDataOut++; | nDataOut++; | ||||
} else if ((whichType == TX_MULTISIG) && (!fIsBareMultisigStd)) { | } else if ((whichType == TX_MULTISIG) && (!permit_bare_multisig)) { | ||||
reason = "bare-multisig"; | reason = "bare-multisig"; | ||||
return false; | return false; | ||||
} else if (IsDust(txout, ::dustRelayFee)) { | } else if (IsDust(txout, dust_relay_fee)) { | ||||
reason = "dust"; | reason = "dust"; | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
// only one OP_RETURN txout is permitted | // only one OP_RETURN txout is permitted | ||||
if (nDataOut > 1) { | if (nDataOut > 1) { | ||||
reason = "multi-op-return"; | reason = "multi-op-return"; | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |