| 1037 | } |
| 1038 | |
| 1039 | static CScript |
| 1040 | sign_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 | } |
| 1062 | static CScript |
| 1063 | sign_multisig(const CScript& scriptPubKey, const CKey& key, const CTransaction& transaction) |
| 1064 | { |
no test coverage detected