| 1068 | } |
| 1069 | |
| 1070 | static CScript |
| 1071 | sign_multisig(const CScript& scriptPubKey, const std::vector<CKey>& keys, const CTransaction& transaction) |
| 1072 | { |
| 1073 | uint256 hash = SignatureHash(scriptPubKey, transaction, 0, SIGHASH_ALL, 0, SigVersion::BASE, 0); |
| 1074 | |
| 1075 | CScript result; |
| 1076 | // |
| 1077 | // NOTE: CHECKMULTISIG has an unfortunate bug; it requires |
| 1078 | // one extra item on the stack, before the signatures. |
| 1079 | // Putting OP_0 on the stack is the workaround; |
| 1080 | // fixing the bug would mean splitting the block chain (old |
| 1081 | // clients would not accept new CHECKMULTISIG transactions, |
| 1082 | // and vice-versa) |
| 1083 | // |
| 1084 | result << OP_0; |
| 1085 | for (const CKey &key : keys) |
| 1086 | { |
| 1087 | std::vector<unsigned char> vchSig; |
| 1088 | BOOST_CHECK(key.Sign(hash, vchSig)); |
| 1089 | vchSig.push_back((unsigned char)SIGHASH_ALL); |
| 1090 | result << vchSig; |
| 1091 | } |
| 1092 | return result; |
| 1093 | } |
| 1094 | static CScript |
| 1095 | sign_multisig(const CScript& scriptPubKey, const CKey& key, const CTransaction& transaction) |
| 1096 | { |
no test coverage detected