MCPcopy Create free account
hub / github.com/LUX-Core/lux / sign_multisig

Function sign_multisig

src/test/script_tests.cpp:1039–1061  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1037}
1038
1039static CScript
1040sign_multisig(const CScript& scriptPubKey, const std::vector<CKey>& keys, const CTransaction& transaction)
1041{
1042 uint256 hash = SignatureHash(scriptPubKey, transaction, 0, SIGHASH_ALL, 0, SIGVERSION_BASE);
1043
1044 CScript result;
1045 //
1046 // NOTE: CHECKMULTISIG has an unfortunate bug; it requires
1047 // one extra item on the stack, before the signatures.
1048 // Putting OP_0 on the stack is the workaround;
1049 // fixing the bug would mean splitting the block chain (old
1050 // clients would not accept new CHECKMULTISIG transactions,
1051 // and vice-versa)
1052 //
1053 result << OP_0;
1054 for (const CKey &key : keys) {
1055 vector<unsigned char> vchSig;
1056 BOOST_CHECK(key.Sign(hash, vchSig));
1057 vchSig.push_back((unsigned char)SIGHASH_ALL);
1058 result << vchSig;
1059 }
1060 return result;
1061}
1062static CScript
1063sign_multisig(const CScript& scriptPubKey, const CKey& key, const CTransaction& transaction)
1064{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.70

Calls 3

SignatureHashFunction · 0.50
SignMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected