Changeset View
Changeset View
Standalone View
Standalone View
src/test/multisig_tests.cpp
Show All 15 Lines | |||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
typedef std::vector<uint8_t> valtype; | typedef std::vector<uint8_t> valtype; | ||||
BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup) | BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup) | ||||
CScript sign_multisig(CScript scriptPubKey, std::vector<CKey> keys, | CScript sign_multisig(CScript scriptPubKey, std::vector<CKey> keys, | ||||
CTransaction transaction, int whichIn) { | CTransaction transaction, int whichIn) { | ||||
uint256 hash = | uint256 hash = SignatureHash(scriptPubKey, transaction, whichIn, | ||||
SignatureHash(scriptPubKey, transaction, whichIn, SIGHASH_ALL, 0); | SIGHASH_ALL, 0, CScript()); | ||||
CScript result; | CScript result; | ||||
// CHECKMULTISIG bug workaround | // CHECKMULTISIG bug workaround | ||||
result << OP_0; | result << OP_0; | ||||
for (const CKey &key : keys) { | for (const CKey &key : keys) { | ||||
std::vector<uint8_t> vchSig; | std::vector<uint8_t> vchSig; | ||||
BOOST_CHECK(key.Sign(hash, vchSig)); | BOOST_CHECK(key.Sign(hash, vchSig)); | ||||
vchSig.push_back(uint8_t(SIGHASH_ALL)); | vchSig.push_back(uint8_t(SIGHASH_ALL)); | ||||
▲ Show 20 Lines • Show All 326 Lines • Show Last 20 Lines |