Changeset View
Changeset View
Standalone View
Standalone View
src/test/script_P2SH_tests.cpp
Show First 20 Lines • Show All 311 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(AreInputsStandard) { | ||||
CCoinsViewCache coins(&coinsDummy); | CCoinsViewCache coins(&coinsDummy); | ||||
CBasicKeyStore keystore; | CBasicKeyStore keystore; | ||||
CKey key[6]; | CKey key[6]; | ||||
std::vector<CPubKey> keys; | std::vector<CPubKey> keys; | ||||
for (int i = 0; i < 6; i++) { | for (int i = 0; i < 6; i++) { | ||||
key[i].MakeNewKey(true); | key[i].MakeNewKey(true); | ||||
keystore.AddKey(key[i]); | keystore.AddKey(key[i]); | ||||
} | } | ||||
for (int i = 0; i < 3; i++) | for (int i = 0; i < 3; i++) { | ||||
keys.push_back(key[i].GetPubKey()); | keys.push_back(key[i].GetPubKey()); | ||||
} | |||||
CMutableTransaction txFrom; | CMutableTransaction txFrom; | ||||
txFrom.vout.resize(7); | txFrom.vout.resize(7); | ||||
// First three are standard: | // First three are standard: | ||||
CScript pay1 = GetScriptForDestination(key[0].GetPubKey().GetID()); | CScript pay1 = GetScriptForDestination(key[0].GetPubKey().GetID()); | ||||
keystore.AddCScript(pay1); | keystore.AddCScript(pay1); | ||||
CScript pay1of3 = GetScriptForMultisig(1, keys); | CScript pay1of3 = GetScriptForMultisig(1, keys); | ||||
Show All 21 Lines | BOOST_AUTO_TEST_CASE(AreInputsStandard) { | ||||
oneAndTwo << OP_3 << OP_CHECKMULTISIG; | oneAndTwo << OP_3 << OP_CHECKMULTISIG; | ||||
keystore.AddCScript(oneAndTwo); | keystore.AddCScript(oneAndTwo); | ||||
txFrom.vout[3].scriptPubKey = GetScriptForDestination(CScriptID(oneAndTwo)); | txFrom.vout[3].scriptPubKey = GetScriptForDestination(CScriptID(oneAndTwo)); | ||||
txFrom.vout[3].nValue = Amount(4000); | txFrom.vout[3].nValue = Amount(4000); | ||||
// vout[4] is max sigops: | // vout[4] is max sigops: | ||||
CScript fifteenSigops; | CScript fifteenSigops; | ||||
fifteenSigops << OP_1; | fifteenSigops << OP_1; | ||||
for (unsigned i = 0; i < MAX_P2SH_SIGOPS; i++) | for (unsigned i = 0; i < MAX_P2SH_SIGOPS; i++) { | ||||
fifteenSigops << ToByteVector(key[i % 3].GetPubKey()); | fifteenSigops << ToByteVector(key[i % 3].GetPubKey()); | ||||
} | |||||
fifteenSigops << OP_15 << OP_CHECKMULTISIG; | fifteenSigops << OP_15 << OP_CHECKMULTISIG; | ||||
keystore.AddCScript(fifteenSigops); | keystore.AddCScript(fifteenSigops); | ||||
txFrom.vout[4].scriptPubKey = | txFrom.vout[4].scriptPubKey = | ||||
GetScriptForDestination(CScriptID(fifteenSigops)); | GetScriptForDestination(CScriptID(fifteenSigops)); | ||||
txFrom.vout[4].nValue = Amount(5000); | txFrom.vout[4].nValue = Amount(5000); | ||||
// vout[5/6] are non-standard because they exceed MAX_P2SH_SIGOPS | // vout[5/6] are non-standard because they exceed MAX_P2SH_SIGOPS | ||||
CScript sixteenSigops; | CScript sixteenSigops; | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |