MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetP2SHSigOpCount

Function GetP2SHSigOpCount

src/consensus/tx_verify.cpp:136–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& inputs)
137{
138 if (tx.IsCoinBase())
139 return 0;
140
141 unsigned int nSigOps = 0;
142 for (unsigned int i = 0; i < tx.vin.size(); i++)
143 {
144 // Peg-in inputs are segwit-only
145 if (tx.vin[i].m_is_pegin) {
146 continue;
147 }
148
149 const Coin& coin = inputs.AccessCoin(tx.vin[i].prevout);
150 assert(!coin.IsSpent());
151 const CTxOut &prevout = coin.out;
152 if (prevout.scriptPubKey.IsPayToScriptHash())
153 nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig);
154 }
155 return nSigOps;
156}
157
158int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& inputs, uint32_t flags)
159{

Callers 3

BOOST_AUTO_TEST_CASEFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85
GetTransactionSigOpCostFunction · 0.85

Calls 5

IsPayToScriptHashMethod · 0.80
IsCoinBaseMethod · 0.45
sizeMethod · 0.45
IsSpentMethod · 0.45
GetSigOpCountMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68