Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show First 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | // TODO: add tests for remaining script flags | ||||
tx.vout[0].scriptPubKey = p2pk_scriptPubKey; | tx.vout[0].scriptPubKey = p2pk_scriptPubKey; | ||||
// Sign | // Sign | ||||
SignatureData sigdata; | SignatureData sigdata; | ||||
ProduceSignature(keystore, | ProduceSignature(keystore, | ||||
MutableTransactionSignatureCreator( | MutableTransactionSignatureCreator( | ||||
&tx, 0, 11 * CENT, SigHashType().withForkId()), | &tx, 0, 11 * CENT, SigHashType().withForkId()), | ||||
spend_tx.vout[0].scriptPubKey, sigdata); | spend_tx.vout[0].scriptPubKey, sigdata); | ||||
UpdateTransaction(tx, 0, sigdata); | UpdateInput(tx.vin[0], sigdata); | ||||
ProduceSignature(keystore, | ProduceSignature(keystore, | ||||
MutableTransactionSignatureCreator( | MutableTransactionSignatureCreator( | ||||
&tx, 1, 11 * CENT, SigHashType().withForkId()), | &tx, 1, 11 * CENT, SigHashType().withForkId()), | ||||
spend_tx.vout[3].scriptPubKey, sigdata); | spend_tx.vout[3].scriptPubKey, sigdata); | ||||
UpdateTransaction(tx, 1, sigdata); | UpdateInput(tx.vin[1], sigdata); | ||||
// This should be valid under all script flags | // This should be valid under all script flags | ||||
ValidateCheckInputsForAllFlags(CTransaction(tx), 0, true, false); | ValidateCheckInputsForAllFlags(CTransaction(tx), 0, true, false); | ||||
// Check that if the second input is invalid, but the first input is | // Check that if the second input is invalid, but the first input is | ||||
// valid, the transaction is not cached. | // valid, the transaction is not cached. | ||||
// Invalidate vin[1] | // Invalidate vin[1] | ||||
tx.vin[1].scriptSig = CScript(); | tx.vin[1].scriptSig = CScript(); | ||||
Show All 24 Lines |