MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / sign_multisig

Function sign_multisig

src/test/script_tests.cpp:789–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787}
788
789CScript
790sign_multisig(CScript scriptPubKey, std::vector<CKey> keys, CTransaction transaction)
791{
792 uint256 hash = SignatureHash(scriptPubKey, transaction, 0, SIGHASH_ALL, 0);
793
794 CScript result;
795 //
796 // NOTE: CHECKMULTISIG has an unfortunate bug; it requires
797 // one extra item on the stack, before the signatures.
798 // Putting OP_0 on the stack is the workaround;
799 // fixing the bug would mean splitting the block chain (old
800 // clients would not accept new CHECKMULTISIG transactions,
801 // and vice-versa)
802 //
803 result << OP_0;
804 BOOST_FOREACH(const CKey &key, keys)
805 {
806 vector<unsigned char> vchSig;
807 BOOST_CHECK(key.Sign(hash, vchSig));
808 vchSig.push_back((unsigned char)SIGHASH_ALL);
809 result << vchSig;
810 }
811 return result;
812}
813CScript
814sign_multisig(CScript scriptPubKey, const CKey &key, CTransaction transaction)
815{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.70

Calls 2

SignatureHashFunction · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected