* Builds a creationTx from scriptPubKey and a spendingTx from scriptSig * and witness such that spendingTx spends output zero of creationTx. * Also inserts creationTx's output into the coins view. */
| 83 | * Also inserts creationTx's output into the coins view. |
| 84 | */ |
| 85 | static void BuildTxs(CMutableTransaction& spendingTx, CCoinsViewCache& coins, CMutableTransaction& creationTx, const CScript& scriptPubKey, const CScript& scriptSig, const CScriptWitness& witness) |
| 86 | { |
| 87 | creationTx.nVersion = 1; |
| 88 | creationTx.vin.resize(1); |
| 89 | creationTx.vin[0].prevout.SetNull(); |
| 90 | creationTx.vin[0].scriptSig = CScript(); |
| 91 | creationTx.vout.resize(1); |
| 92 | creationTx.vout[0].nValue = 1; |
| 93 | creationTx.vout[0].scriptPubKey = scriptPubKey; |
| 94 | |
| 95 | spendingTx.nVersion = 1; |
| 96 | spendingTx.vin.resize(1); |
| 97 | spendingTx.vin[0].prevout.hash = creationTx.GetHash(); |
| 98 | spendingTx.vin[0].prevout.n = 0; |
| 99 | spendingTx.vin[0].scriptSig = scriptSig; |
| 100 | spendingTx.vin[0].scriptWitness = witness; |
| 101 | spendingTx.vout.resize(1); |
| 102 | spendingTx.vout[0].nValue = 1; |
| 103 | spendingTx.vout[0].scriptPubKey = CScript(); |
| 104 | |
| 105 | AddCoins(coins, creationTx, 0); |
| 106 | } |
| 107 | |
| 108 | BOOST_AUTO_TEST_CASE(GetTxSigOpCost) |
| 109 | { |