@@ -242,6 +242,7 @@ class OriginPubkeyProvider final : public PubkeyProvider
242
242
{
243
243
std::optional<CPubKey> pub = m_provider->GetPubKey (pos, arg, out, read_cache, write_cache);
244
244
if (!pub) return std::nullopt;
245
+ Assert (out.pubkeys .contains (pub->GetID ()));
245
246
auto & [pubkey, suborigin] = out.origins [pub->GetID ()];
246
247
Assert (pubkey == *pub); // All subproviders must be inserting a valid origin already
247
248
std::copy (std::begin (m_origin.fingerprint ), std::end (m_origin.fingerprint ), suborigin.fingerprint );
@@ -305,6 +306,7 @@ class ConstPubkeyProvider final : public PubkeyProvider
305
306
CKeyID keyid = m_pubkey.GetID ();
306
307
std::copy (keyid.begin (), keyid.begin () + sizeof (info.fingerprint ), info.fingerprint );
307
308
out.origins .emplace (keyid, std::make_pair (m_pubkey, info));
309
+ out.pubkeys .emplace (keyid, m_pubkey);
308
310
return m_pubkey;
309
311
}
310
312
bool IsRange () const override { return false ; }
@@ -449,6 +451,7 @@ class BIP32PubkeyProvider final : public PubkeyProvider
449
451
if (!der) return std::nullopt;
450
452
451
453
out.origins .emplace (final_extkey.pubkey .GetID (), std::make_pair (final_extkey.pubkey , info));
454
+ out.pubkeys .emplace (final_extkey.pubkey .GetID (), final_extkey.pubkey );
452
455
453
456
if (write_cache) {
454
457
// Only cache parent if there is any unhardened derivation
@@ -887,7 +890,6 @@ class PKHDescriptor final : public DescriptorImpl
887
890
std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, Span<const CScript>, FlatSigningProvider& out) const override
888
891
{
889
892
CKeyID id = keys[0 ].GetID ();
890
- out.pubkeys .emplace (id, keys[0 ]);
891
893
return Vector (GetScriptForDestination (PKHash (id)));
892
894
}
893
895
public:
@@ -922,7 +924,6 @@ class WPKHDescriptor final : public DescriptorImpl
922
924
std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, Span<const CScript>, FlatSigningProvider& out) const override
923
925
{
924
926
CKeyID id = keys[0 ].GetID ();
925
- out.pubkeys .emplace (id, keys[0 ]);
926
927
return Vector (GetScriptForDestination (WitnessV0KeyHash (id)));
927
928
}
928
929
public:
@@ -958,7 +959,6 @@ class ComboDescriptor final : public DescriptorImpl
958
959
{
959
960
std::vector<CScript> ret;
960
961
CKeyID id = keys[0 ].GetID ();
961
- out.pubkeys .emplace (id, keys[0 ]);
962
962
ret.emplace_back (GetScriptForRawPubKey (keys[0 ])); // P2PK
963
963
ret.emplace_back (GetScriptForDestination (PKHash (id))); // P2PKH
964
964
if (keys[0 ].IsCompressed ()) {
@@ -1185,7 +1185,6 @@ class TRDescriptor final : public DescriptorImpl
1185
1185
builder.Finalize (xpk);
1186
1186
WitnessV1Taproot output = builder.GetOutput ();
1187
1187
out.tr_trees [output] = builder;
1188
- out.pubkeys .emplace (keys[0 ].GetID (), keys[0 ]);
1189
1188
return Vector (GetScriptForDestination (output));
1190
1189
}
1191
1190
bool ToStringSubScriptHelper (const SigningProvider* arg, std::string& ret, const StringType type, const DescriptorCache* cache = nullptr ) const override
0 commit comments