@@ -73,15 +73,18 @@ static bool GetPubKey(const SigningProvider& provider, SignatureData& sigdata, c
73
73
return false ;
74
74
}
75
75
76
- 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)
76
+ 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)
77
77
{
78
+ CKeyID keyid = pubkey.GetID ();
78
79
const auto it = sigdata.signatures .find (keyid);
79
80
if (it != sigdata.signatures .end ()) {
80
81
sig_out = it->second .second ;
81
82
return true ;
82
83
}
83
- CPubKey pubkey;
84
- GetPubKey (provider, sigdata, keyid, pubkey);
84
+ KeyOriginInfo info;
85
+ if (provider.GetKeyOrigin (keyid, info)) {
86
+ sigdata.misc_pubkeys .emplace (keyid, std::make_pair (pubkey, std::move (info)));
87
+ }
85
88
if (creator.CreateSig (provider, sig_out, keyid, scriptcode, sigversion)) {
86
89
auto i = sigdata.signatures .emplace (keyid, SigPair (pubkey, sig_out));
87
90
assert (i.second );
@@ -114,15 +117,15 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
114
117
case TX_WITNESS_UNKNOWN:
115
118
return false ;
116
119
case TX_PUBKEY:
117
- if (!CreateSig (creator, sigdata, provider, sig, CPubKey (vSolutions[0 ]). GetID () , scriptPubKey, sigversion)) return false ;
120
+ if (!CreateSig (creator, sigdata, provider, sig, CPubKey (vSolutions[0 ]), scriptPubKey, sigversion)) return false ;
118
121
ret.push_back (std::move (sig));
119
122
return true ;
120
123
case TX_PUBKEYHASH: {
121
124
CKeyID keyID = CKeyID (uint160 (vSolutions[0 ]));
122
- if (!CreateSig (creator, sigdata, provider, sig, keyID, scriptPubKey, sigversion)) return false ;
123
- ret.push_back (std::move (sig));
124
125
CPubKey pubkey;
125
126
GetPubKey (provider, sigdata, keyID, pubkey);
127
+ if (!CreateSig (creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) return false ;
128
+ ret.push_back (std::move (sig));
126
129
ret.push_back (ToByteVector (pubkey));
127
130
return true ;
128
131
}
@@ -138,7 +141,7 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
138
141
ret.push_back (valtype ()); // workaround CHECKMULTISIG bug
139
142
for (size_t i = 1 ; i < vSolutions.size () - 1 ; ++i) {
140
143
CPubKey pubkey = CPubKey (vSolutions[i]);
141
- if (ret.size () < required + 1 && CreateSig (creator, sigdata, provider, sig, pubkey. GetID () , scriptPubKey, sigversion)) {
144
+ if (ret.size () < required + 1 && CreateSig (creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) {
142
145
ret.push_back (std::move (sig));
143
146
}
144
147
}
0 commit comments