MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetTransactionSigOpCost

Function GetTransactionSigOpCost

src/main.cpp:849–866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847}
848
849int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& inputs, int flags)
850{
851 int64_t nSigOps = GetLegacySigOpCount(tx) * WITNESS_SCALE_FACTOR;
852
853 if (tx.IsCoinBase())
854 return nSigOps;
855
856 if (flags & SCRIPT_VERIFY_P2SH) {
857 nSigOps += GetP2SHSigOpCount(tx, inputs) * WITNESS_SCALE_FACTOR;
858 }
859
860 for (unsigned int i = 0; i < tx.vin.size(); i++)
861 {
862 const CTxOut &prevout = inputs.GetOutputFor(tx.vin[i]);
863 nSigOps += CountWitnessSigOps(tx.vin[i].scriptSig, prevout.scriptPubKey, i < tx.wit.vtxinwit.size() ? &tx.wit.vtxinwit[i].scriptWitness : NULL, flags);
864 }
865 return nSigOps;
866}
867
868bool CheckTransaction(const CTransaction& tx, CValidationState& state)
869{

Callers 4

AcceptToMemoryPoolFunction · 0.85
AcceptableInputsFunction · 0.85
ConnectBlockFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 5

GetLegacySigOpCountFunction · 0.85
GetP2SHSigOpCountFunction · 0.85
CountWitnessSigOpsFunction · 0.85
IsCoinBaseMethod · 0.45
sizeMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68