| 134 | } |
| 135 | |
| 136 | unsigned 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 | |
| 158 | int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& inputs, uint32_t flags) |
| 159 | { |