| 1205 | } |
| 1206 | |
| 1207 | static CScript |
| 1208 | sign_multisig(const CScript& scriptPubKey, const std::vector<CKey>& keys, const CTransaction& transaction) |
| 1209 | { |
| 1210 | uint256 hash = SignatureHash(scriptPubKey, transaction, 0, SIGHASH_ALL | SIGHASH_FORKID, 0, SigVersion::BASE, false); |
| 1211 | |
| 1212 | CScript result; |
| 1213 | // |
| 1214 | // NOTE: CHECKMULTISIG has an unfortunate bug; it requires |
| 1215 | // one extra item on the stack, before the signatures. |
| 1216 | // Putting OP_0 on the stack is the workaround; |
| 1217 | // fixing the bug would mean splitting the block chain (old |
| 1218 | // clients would not accept new CHECKMULTISIG transactions, |
| 1219 | // and vice-versa) |
| 1220 | // |
| 1221 | result << OP_0; |
| 1222 | for (const CKey &key : keys) |
| 1223 | { |
| 1224 | std::vector<unsigned char> vchSig; |
| 1225 | BOOST_CHECK(key.Sign(hash, vchSig)); |
| 1226 | vchSig.push_back((unsigned char)(SIGHASH_ALL | SIGHASH_FORKID)); |
| 1227 | result << vchSig; |
| 1228 | } |
| 1229 | return result; |
| 1230 | } |
| 1231 | static CScript |
| 1232 | sign_multisig(const CScript& scriptPubKey, const CKey& key, const CTransaction& transaction) |
| 1233 | { |
no test coverage detected