@@ -226,7 +226,7 @@ class DescriptorImpl : public Descriptor
226
226
* @param pubkeys The evaluations of the m_pubkey_args field.
227
227
* @param script The evaluation of m_script_arg (or nullptr when m_script_arg is nullptr).
228
228
* @param out A FlatSigningProvider to put scripts or public keys in that are necessary to the solver.
229
- * The script and pubkeys argument to this function are automatically added.
229
+ * The script arguments to this function are automatically added, as is the origin info of the provided pubkeys .
230
230
* @return A vector with scriptPubKeys for this descriptor.
231
231
*/
232
232
virtual std::vector<CScript> MakeScripts (const std::vector<CPubKey>& pubkeys, const CScript* script, FlatSigningProvider& out) const = 0;
@@ -322,7 +322,6 @@ class DescriptorImpl : public Descriptor
322
322
for (auto & entry : entries) {
323
323
pubkeys.push_back (entry.first );
324
324
out.origins .emplace (entry.first .GetID (), std::move (entry.second ));
325
- out.pubkeys .emplace (entry.first .GetID (), entry.first );
326
325
}
327
326
if (m_script_arg) {
328
327
for (const auto & subscript : subscripts) {
@@ -396,7 +395,12 @@ class PKDescriptor final : public DescriptorImpl
396
395
class PKHDescriptor final : public DescriptorImpl
397
396
{
398
397
protected:
399
- std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, const CScript*, FlatSigningProvider&) const override { return Singleton (GetScriptForDestination (keys[0 ].GetID ())); }
398
+ std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, const CScript*, FlatSigningProvider& out) const override
399
+ {
400
+ CKeyID id = keys[0 ].GetID ();
401
+ out.pubkeys .emplace (id, keys[0 ]);
402
+ return Singleton (GetScriptForDestination (id));
403
+ }
400
404
public:
401
405
PKHDescriptor (std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Singleton(std::move(prov)), {}, " pkh" ) {}
402
406
};
@@ -405,7 +409,12 @@ class PKHDescriptor final : public DescriptorImpl
405
409
class WPKHDescriptor final : public DescriptorImpl
406
410
{
407
411
protected:
408
- std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, const CScript*, FlatSigningProvider&) const override { return Singleton (GetScriptForDestination (WitnessV0KeyHash (keys[0 ].GetID ()))); }
412
+ std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, const CScript*, FlatSigningProvider& out) const override
413
+ {
414
+ CKeyID id = keys[0 ].GetID ();
415
+ out.pubkeys .emplace (id, keys[0 ]);
416
+ return Singleton (GetScriptForDestination (WitnessV0KeyHash (id)));
417
+ }
409
418
public:
410
419
WPKHDescriptor (std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Singleton(std::move(prov)), {}, " wpkh" ) {}
411
420
};
@@ -418,6 +427,7 @@ class ComboDescriptor final : public DescriptorImpl
418
427
{
419
428
std::vector<CScript> ret;
420
429
CKeyID id = keys[0 ].GetID ();
430
+ out.pubkeys .emplace (id, keys[0 ]);
421
431
ret.emplace_back (GetScriptForRawPubKey (keys[0 ])); // P2PK
422
432
ret.emplace_back (GetScriptForDestination (id)); // P2PKH
423
433
if (keys[0 ].IsCompressed ()) {
0 commit comments