Changeset View
Changeset View
Standalone View
Standalone View
src/consensus/tx_verify.cpp
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | |||||
bool SequenceLocks(const CTransaction &tx, int flags, | bool SequenceLocks(const CTransaction &tx, int flags, | ||||
std::vector<int> *prevHeights, const CBlockIndex &block) { | std::vector<int> *prevHeights, const CBlockIndex &block) { | ||||
return EvaluateSequenceLocks( | return EvaluateSequenceLocks( | ||||
block, CalculateSequenceLocks(tx, flags, prevHeights, block)); | block, CalculateSequenceLocks(tx, flags, prevHeights, block)); | ||||
} | } | ||||
uint64_t GetSigOpCountWithoutP2SH(const CTransaction &tx, uint32_t flags) { | uint64_t GetSigOpCountWithoutP2SH(const CTransaction &tx, uint32_t flags) { | ||||
uint64_t nSigOps = 0; | return 0; | ||||
for (const auto &txin : tx.vin) { | |||||
nSigOps += txin.scriptSig.GetSigOpCount(flags, false); | |||||
} | |||||
for (const auto &txout : tx.vout) { | |||||
nSigOps += txout.scriptPubKey.GetSigOpCount(flags, false); | |||||
} | |||||
return nSigOps; | |||||
} | } | ||||
uint64_t GetP2SHSigOpCount(const CTransaction &tx, const CCoinsViewCache &view, | uint64_t GetP2SHSigOpCount(const CTransaction &tx, const CCoinsViewCache &view, | ||||
uint32_t flags) { | uint32_t flags) { | ||||
if ((flags & SCRIPT_VERIFY_P2SH) == 0 || tx.IsCoinBase()) { | |||||
return 0; | return 0; | ||||
} | } | ||||
uint64_t nSigOps = 0; | |||||
for (auto &i : tx.vin) { | |||||
const CTxOut &prevout = view.GetOutputFor(i); | |||||
if (prevout.scriptPubKey.IsPayToScriptHash()) { | |||||
nSigOps += prevout.scriptPubKey.GetSigOpCount(flags, i.scriptSig); | |||||
} | |||||
} | |||||
return nSigOps; | |||||
} | |||||
uint64_t GetTransactionSigOpCount(const CTransaction &tx, | uint64_t GetTransactionSigOpCount(const CTransaction &tx, | ||||
const CCoinsViewCache &view, uint32_t flags) { | const CCoinsViewCache &view, uint32_t flags) { | ||||
return GetSigOpCountWithoutP2SH(tx, flags) + | return GetSigOpCountWithoutP2SH(tx, flags) + | ||||
GetP2SHSigOpCount(tx, view, flags); | GetP2SHSigOpCount(tx, view, flags); | ||||
} | } | ||||
namespace Consensus { | namespace Consensus { | ||||
bool CheckTxInputs(const CTransaction &tx, CValidationState &state, | bool CheckTxInputs(const CTransaction &tx, CValidationState &state, | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |