| 787 | } |
| 788 | |
| 789 | CScript |
| 790 | sign_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 | } |
| 813 | CScript |
| 814 | sign_multisig(CScript scriptPubKey, const CKey &key, CTransaction transaction) |
| 815 | { |
no test coverage detected