@@ -134,10 +134,10 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost)
134134 // Legacy counting only includes signature operations in scriptSigs and scriptPubKeys
135135 // of a transaction and does not take the actual executed sig operations into account.
136136 // spendingTx in itself does not contain a signature operation.
137- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags) == 0 );
137+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags) == 0 );
138138 // creationTx contains two signature operations in its scriptPubKey, but legacy counting
139139 // is not accurate.
140- assert (GetTransactionSigOpCost (CTransaction (creationTx), coins , flags) == MAX_PUBKEYS_PER_MULTISIG * WITNESS_SCALE_FACTOR);
140+ assert (GetTransactionSigOpCost (CTransaction (creationTx), {} , flags) == MAX_PUBKEYS_PER_MULTISIG * WITNESS_SCALE_FACTOR);
141141 // Sanity check: script verification fails because of an invalid signature.
142142 assert (VerifyWithFlag (CTransaction (creationTx), spendingTx, flags) == SCRIPT_ERR_CHECKMULTISIGVERIFY);
143143 }
@@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost)
149149 CScript scriptSig = CScript () << OP_0 << OP_0 << ToByteVector (redeemScript);
150150
151151 BuildTxs (spendingTx, coins, creationTx, scriptPubKey, scriptSig, CScriptWitness ());
152- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags) == 2 * WITNESS_SCALE_FACTOR);
152+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags) == 2 * WITNESS_SCALE_FACTOR);
153153 assert (VerifyWithFlag (CTransaction (creationTx), spendingTx, flags) == SCRIPT_ERR_CHECKMULTISIGVERIFY);
154154 }
155155
@@ -163,22 +163,22 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost)
163163
164164
165165 BuildTxs (spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
166- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags) == 1 );
166+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags) == 1 );
167167 // No signature operations if we don't verify the witness.
168- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags & ~SCRIPT_VERIFY_WITNESS) == 0 );
168+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags & ~SCRIPT_VERIFY_WITNESS) == 0 );
169169 assert (VerifyWithFlag (CTransaction (creationTx), spendingTx, flags) == SCRIPT_ERR_EQUALVERIFY);
170170
171171 // The sig op cost for witness version != 0 is zero.
172172 assert (scriptPubKey[0 ] == 0x00 );
173173 scriptPubKey[0 ] = 0x51 ;
174174 BuildTxs (spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
175- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags) == 0 );
175+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags) == 0 );
176176 scriptPubKey[0 ] = 0x00 ;
177177 BuildTxs (spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
178178
179179 // The witness of a coinbase transaction is not taken into account.
180180 spendingTx.vin [0 ].prevout .SetNull ();
181- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins , flags) == 0 );
181+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), {} , flags) == 0 );
182182 }
183183
184184 // P2WPKH nested in P2SH
@@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost)
191191 scriptWitness.stack .emplace_back (0 );
192192
193193 BuildTxs (spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
194- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags) == 1 );
194+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags) == 1 );
195195 assert (VerifyWithFlag (CTransaction (creationTx), spendingTx, flags) == SCRIPT_ERR_EQUALVERIFY);
196196 }
197197
@@ -206,8 +206,8 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost)
206206 scriptWitness.stack .emplace_back (witnessScript.begin (), witnessScript.end ());
207207
208208 BuildTxs (spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
209- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags) == 2 );
210- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags & ~SCRIPT_VERIFY_WITNESS) == 0 );
209+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags) == 2 );
210+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags & ~SCRIPT_VERIFY_WITNESS) == 0 );
211211 assert (VerifyWithFlag (CTransaction (creationTx), spendingTx, flags) == SCRIPT_ERR_CHECKMULTISIGVERIFY);
212212 }
213213
@@ -223,7 +223,7 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost)
223223 scriptWitness.stack .emplace_back (witnessScript.begin (), witnessScript.end ());
224224
225225 BuildTxs (spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
226- assert (GetTransactionSigOpCost (CTransaction (spendingTx), coins, flags) == 2 );
226+ assert (GetTransactionSigOpCost (CTransaction (spendingTx), * Assert ( coins. GetInputs ( CTransaction (spendingTx))) , flags) == 2 );
227227 assert (VerifyWithFlag (CTransaction (creationTx), spendingTx, flags) == SCRIPT_ERR_CHECKMULTISIGVERIFY);
228228 }
229229}
0 commit comments