Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show First 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | // TODO: add tests for remaining script flags | ||||
tx.vin[0].prevout = COutPoint(spend_tx.GetId(), 0); | tx.vin[0].prevout = COutPoint(spend_tx.GetId(), 0); | ||||
tx.vin[1].prevout = COutPoint(spend_tx.GetId(), 3); | tx.vin[1].prevout = COutPoint(spend_tx.GetId(), 3); | ||||
tx.vout.resize(1); | tx.vout.resize(1); | ||||
tx.vout[0].nValue = 22 * CENT; | tx.vout[0].nValue = 22 * CENT; | ||||
tx.vout[0].scriptPubKey = p2pk_scriptPubKey; | tx.vout[0].scriptPubKey = p2pk_scriptPubKey; | ||||
// Sign | // Sign | ||||
SignatureData sigdata; | SignatureData sigdata; | ||||
ProduceSignature( | ProduceSignature(keystore, | ||||
MutableTransactionSignatureCreator(&keystore, &tx, 0, 11 * CENT, | MutableTransactionSignatureCreator( | ||||
SigHashType().withForkId()), | &tx, 0, 11 * CENT, SigHashType().withForkId()), | ||||
spend_tx.vout[0].scriptPubKey, sigdata); | spend_tx.vout[0].scriptPubKey, sigdata); | ||||
UpdateTransaction(tx, 0, sigdata); | UpdateTransaction(tx, 0, sigdata); | ||||
ProduceSignature( | ProduceSignature(keystore, | ||||
MutableTransactionSignatureCreator(&keystore, &tx, 1, 11 * CENT, | MutableTransactionSignatureCreator( | ||||
SigHashType().withForkId()), | &tx, 1, 11 * CENT, SigHashType().withForkId()), | ||||
spend_tx.vout[3].scriptPubKey, sigdata); | spend_tx.vout[3].scriptPubKey, sigdata); | ||||
UpdateTransaction(tx, 1, sigdata); | UpdateTransaction(tx, 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] | ||||
Show All 25 Lines |