@@ -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 ; }
@@ -442,6 +444,7 @@ class BIP32PubkeyProvider final : public PubkeyProvider
442
444
if (!der) return std::nullopt;
443
445
444
446
out.origins .emplace (final_extkey.pubkey .GetID (), std::make_pair (final_extkey.pubkey , info));
447
+ out.pubkeys .emplace (final_extkey.pubkey .GetID (), final_extkey.pubkey );
445
448
446
449
if (write_cache) {
447
450
// Only cache parent if there is any unhardened derivation
@@ -877,10 +880,9 @@ class PKDescriptor final : public DescriptorImpl
877
880
class PKHDescriptor final : public DescriptorImpl
878
881
{
879
882
protected:
880
- std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, Span<const CScript>, FlatSigningProvider& out ) const override
883
+ std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, Span<const CScript>, FlatSigningProvider&) const override
881
884
{
882
885
CKeyID id = keys[0 ].GetID ();
883
- out.pubkeys .emplace (id, keys[0 ]);
884
886
return Vector (GetScriptForDestination (PKHash (id)));
885
887
}
886
888
public:
@@ -912,10 +914,9 @@ class PKHDescriptor final : public DescriptorImpl
912
914
class WPKHDescriptor final : public DescriptorImpl
913
915
{
914
916
protected:
915
- std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, Span<const CScript>, FlatSigningProvider& out ) const override
917
+ std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, Span<const CScript>, FlatSigningProvider&) const override
916
918
{
917
919
CKeyID id = keys[0 ].GetID ();
918
- out.pubkeys .emplace (id, keys[0 ]);
919
920
return Vector (GetScriptForDestination (WitnessV0KeyHash (id)));
920
921
}
921
922
public:
@@ -951,7 +952,6 @@ class ComboDescriptor final : public DescriptorImpl
951
952
{
952
953
std::vector<CScript> ret;
953
954
CKeyID id = keys[0 ].GetID ();
954
- out.pubkeys .emplace (id, keys[0 ]);
955
955
ret.emplace_back (GetScriptForRawPubKey (keys[0 ])); // P2PK
956
956
ret.emplace_back (GetScriptForDestination (PKHash (id))); // P2PKH
957
957
if (keys[0 ].IsCompressed ()) {
@@ -1178,7 +1178,6 @@ class TRDescriptor final : public DescriptorImpl
1178
1178
builder.Finalize (xpk);
1179
1179
WitnessV1Taproot output = builder.GetOutput ();
1180
1180
out.tr_trees [output] = builder;
1181
- out.pubkeys .emplace (keys[0 ].GetID (), keys[0 ]);
1182
1181
return Vector (GetScriptForDestination (output));
1183
1182
}
1184
1183
bool ToStringSubScriptHelper (const SigningProvider* arg, std::string& ret, const StringType type, const DescriptorCache* cache = nullptr ) const override
0 commit comments