Changeset View
Changeset View
Standalone View
Standalone View
src/test/multisig_tests.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(multisig_verify) { | ||||
txFrom.vout[2].scriptPubKey = escrow; | txFrom.vout[2].scriptPubKey = escrow; | ||||
// Spending transaction | // Spending transaction | ||||
CMutableTransaction txTo[3]; | CMutableTransaction txTo[3]; | ||||
for (int i = 0; i < 3; i++) { | for (int i = 0; i < 3; i++) { | ||||
txTo[i].vin.resize(1); | txTo[i].vin.resize(1); | ||||
txTo[i].vout.resize(1); | txTo[i].vout.resize(1); | ||||
txTo[i].vin[0].prevout.n = i; | txTo[i].vin[0].prevout.n = i; | ||||
txTo[i].vin[0].prevout.hash = txFrom.GetId(); | txTo[i].vin[0].prevout.hash = txFrom.GetHash(); | ||||
txTo[i].vout[0].nValue = 1; | txTo[i].vout[0].nValue = 1; | ||||
} | } | ||||
std::vector<CKey> keys; | std::vector<CKey> keys; | ||||
CScript s; | CScript s; | ||||
// Test a AND b: | // Test a AND b: | ||||
keys.assign(1, key[0]); | keys.assign(1, key[0]); | ||||
▲ Show 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(multisig_Sign) { | ||||
txFrom.vout[2].scriptPubKey = escrow; | txFrom.vout[2].scriptPubKey = escrow; | ||||
// Spending transaction | // Spending transaction | ||||
CMutableTransaction txTo[3]; | CMutableTransaction txTo[3]; | ||||
for (int i = 0; i < 3; i++) { | for (int i = 0; i < 3; i++) { | ||||
txTo[i].vin.resize(1); | txTo[i].vin.resize(1); | ||||
txTo[i].vout.resize(1); | txTo[i].vout.resize(1); | ||||
txTo[i].vin[0].prevout.n = i; | txTo[i].vin[0].prevout.n = i; | ||||
txTo[i].vin[0].prevout.hash = txFrom.GetId(); | txTo[i].vin[0].prevout.hash = txFrom.GetHash(); | ||||
txTo[i].vout[0].nValue = 1; | txTo[i].vout[0].nValue = 1; | ||||
} | } | ||||
for (int i = 0; i < 3; i++) { | for (int i = 0; i < 3; i++) { | ||||
BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0, | BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0, | ||||
SIGHASH_ALL | SIGHASH_FORKID), | SIGHASH_ALL | SIGHASH_FORKID), | ||||
strprintf("SignSignature %d", i)); | strprintf("SignSignature %d", i)); | ||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |