@@ -69,15 +69,15 @@ static bool GetPubKey(const SigningProvider& provider, SignatureData& sigdata, c
6969 return false ;
7070}
7171
72- static bool CreateSig (const BaseSignatureCreator& creator, SignatureData& sigdata, const SigningProvider& provider, std::vector<unsigned char >& sig_out, const CKeyID& keyid , const CScript& scriptcode, SigVersion sigversion)
72+ static bool CreateSig (const BaseSignatureCreator& creator, SignatureData& sigdata, const SigningProvider& provider, std::vector<unsigned char >& sig_out, const CPubKey& pubkey , const CScript& scriptcode, SigVersion sigversion)
7373{
74+ CKeyID keyid = pubkey.GetID ();
7475 const auto it = sigdata.signatures .find (keyid);
7576 if (it != sigdata.signatures .end ()) {
7677 sig_out = it->second .second ;
7778 return true ;
7879 }
79- CPubKey pubkey;
80- GetPubKey (provider, sigdata, keyid, pubkey);
80+ sigdata.misc_pubkeys .emplace (keyid, pubkey);
8181 if (creator.CreateSig (provider, sig_out, keyid, scriptcode, sigversion)) {
8282 auto i = sigdata.signatures .emplace (keyid, SigPair (pubkey, sig_out));
8383 assert (i.second );
@@ -111,15 +111,15 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
111111 case TX_WITNESS_UNKNOWN:
112112 return false ;
113113 case TX_PUBKEY:
114- if (!CreateSig (creator, sigdata, provider, sig, CPubKey (vSolutions[0 ]). GetID () , scriptPubKey, sigversion)) return false ;
114+ if (!CreateSig (creator, sigdata, provider, sig, CPubKey (vSolutions[0 ]), scriptPubKey, sigversion)) return false ;
115115 ret.push_back (std::move (sig));
116116 return true ;
117117 case TX_PUBKEYHASH: {
118118 CKeyID keyID = CKeyID (uint160 (vSolutions[0 ]));
119- if (!CreateSig (creator, sigdata, provider, sig, keyID, scriptPubKey, sigversion)) return false ;
120- ret.push_back (std::move (sig));
121119 CPubKey pubkey;
122120 GetPubKey (provider, sigdata, keyID, pubkey);
121+ if (!CreateSig (creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) return false ;
122+ ret.push_back (std::move (sig));
123123 ret.push_back (ToByteVector (pubkey));
124124 return true ;
125125 }
@@ -135,7 +135,7 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
135135 ret.push_back (valtype ()); // workaround CHECKMULTISIG bug
136136 for (size_t i = 1 ; i < vSolutions.size () - 1 ; ++i) {
137137 CPubKey pubkey = CPubKey (vSolutions[i]);
138- if (ret.size () < required + 1 && CreateSig (creator, sigdata, provider, sig, pubkey. GetID () , scriptPubKey, sigversion)) {
138+ if (ret.size () < required + 1 && CreateSig (creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) {
139139 ret.push_back (std::move (sig));
140140 }
141141 }
0 commit comments