diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index bb613e6..4c38a7b 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -749,7 +749,7 @@ static CScript _createmultisig(const Array& params) throw runtime_error( strprintf("not enough keys supplied " "(got %"PRIszu" keys, but need at least %d to redeem)", keys.size(), nRequired)); - std::vector pubkeys; + std::vector pubkeys; pubkeys.resize(keys.size()); for (unsigned int i = 0; i < keys.size(); i++) { @@ -763,13 +763,7 @@ static CScript _createmultisig(const Array& params) if (!address.GetKeyID(keyID)) throw runtime_error( strprintf("%s does not refer to a key",ks.c_str())); - CPubKey vchPubKey; - if (!pwalletMain->GetPubKey(keyID, vchPubKey)) - throw runtime_error( - strprintf("no full public key for address %s",ks.c_str())); - if (!vchPubKey.IsFullyValid()) - throw runtime_error(" Invalid public key: "+ks); - pubkeys[i] = vchPubKey; + pubkeys[i] = keyID; } // Case 2: hex public key @@ -778,7 +772,7 @@ static CScript _createmultisig(const Array& params) CPubKey vchPubKey(ParseHex(ks)); if (!vchPubKey.IsFullyValid()) throw runtime_error(" Invalid public key: "+ks); - pubkeys[i] = vchPubKey; + pubkeys[i] = vchPubKey.GetID(); } else { diff --git a/src/script.cpp b/src/script.cpp index 289ea2d..e40a001 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1160,7 +1160,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector= 33 && vch1.size() <= 120) + while (vch1.size() == sizeof(uint160)) { vSolutionsRet.push_back(vch1); if (!script1.GetOp2(pc1, opcode1, &vch1)) @@ -1225,8 +1225,7 @@ bool SignN(const vector& multisigdata, const CKeyStore& keystore, uint2 int nRequired = multisigdata.front()[0]; for (unsigned int i = 1; i < multisigdata.size()-1 && nSigned < nRequired; i++) { - const valtype& pubkey = multisigdata[i]; - CKeyID keyID = CPubKey(pubkey).GetID(); + CKeyID keyID = CKeyID(uint160(multisigdata[i])); if (Sign1(keyID, keystore, hash, nHashType, scriptSigRet)) ++nSigned; } @@ -1311,7 +1310,7 @@ unsigned int HaveKeys(const vector& pubkeys, const CKeyStore& keystore) unsigned int nResult = 0; BOOST_FOREACH(const valtype& pubkey, pubkeys) { - CKeyID keyID = CPubKey(pubkey).GetID(); + CKeyID keyID = CKeyID(uint160(pubkey)); if (keystore.HaveKey(keyID)) ++nResult; } @@ -1770,12 +1769,12 @@ void CScript::SetDestination(const CTxDestination& dest) boost::apply_visitor(CScriptVisitor(this), dest); } -void CScript::SetMultisig(int nRequired, const std::vector& keys) +void CScript::SetMultisig(int nRequired, const std::vector& keys) { this->clear(); *this << EncodeOP_N(nRequired); - BOOST_FOREACH(const CPubKey& key, keys) + BOOST_FOREACH(const CKeyID& key, keys) *this << key; *this << EncodeOP_N(keys.size()) << OP_CHECKMULTISIG; } diff --git a/src/script.h b/src/script.h index 38f33c2..39e337c 100644 --- a/src/script.h +++ b/src/script.h @@ -548,7 +548,7 @@ class CScript : public std::vector void SetDestination(const CTxDestination& address); - void SetMultisig(int nRequired, const std::vector& keys); + void SetMultisig(int nRequired, const std::vector &keys); void PrintHex() const