@@ -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); // m_provider must have a valid origin by this point.
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 ; }
@@ -439,6 +441,7 @@ class BIP32PubkeyProvider final : public PubkeyProvider
439
441
if (!der) return std::nullopt;
440
442
441
443
out.origins .emplace (final_extkey.pubkey .GetID (), std::make_pair (final_extkey.pubkey , info));
444
+ out.pubkeys .emplace (final_extkey.pubkey .GetID (), final_extkey.pubkey );
442
445
443
446
if (write_cache) {
444
447
// Only cache parent if there is any unhardened derivation
@@ -874,10 +877,9 @@ class PKDescriptor final : public DescriptorImpl
874
877
class PKHDescriptor final : public DescriptorImpl
875
878
{
876
879
protected:
877
- std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, std::span<const CScript>, FlatSigningProvider& out ) const override
880
+ std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, std::span<const CScript>, FlatSigningProvider&) const override
878
881
{
879
882
CKeyID id = keys[0 ].GetID ();
880
- out.pubkeys .emplace (id, keys[0 ]);
881
883
return Vector (GetScriptForDestination (PKHash (id)));
882
884
}
883
885
public:
@@ -909,10 +911,9 @@ class PKHDescriptor final : public DescriptorImpl
909
911
class WPKHDescriptor final : public DescriptorImpl
910
912
{
911
913
protected:
912
- std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, std::span<const CScript>, FlatSigningProvider& out ) const override
914
+ std::vector<CScript> MakeScripts (const std::vector<CPubKey>& keys, std::span<const CScript>, FlatSigningProvider&) const override
913
915
{
914
916
CKeyID id = keys[0 ].GetID ();
915
- out.pubkeys .emplace (id, keys[0 ]);
916
917
return Vector (GetScriptForDestination (WitnessV0KeyHash (id)));
917
918
}
918
919
public:
@@ -948,7 +949,6 @@ class ComboDescriptor final : public DescriptorImpl
948
949
{
949
950
std::vector<CScript> ret;
950
951
CKeyID id = keys[0 ].GetID ();
951
- out.pubkeys .emplace (id, keys[0 ]);
952
952
ret.emplace_back (GetScriptForRawPubKey (keys[0 ])); // P2PK
953
953
ret.emplace_back (GetScriptForDestination (PKHash (id))); // P2PKH
954
954
if (keys[0 ].IsCompressed ()) {
@@ -1175,7 +1175,6 @@ class TRDescriptor final : public DescriptorImpl
1175
1175
builder.Finalize (xpk);
1176
1176
WitnessV1Taproot output = builder.GetOutput ();
1177
1177
out.tr_trees [output] = builder;
1178
- out.pubkeys .emplace (keys[0 ].GetID (), keys[0 ]);
1179
1178
return Vector (GetScriptForDestination (output));
1180
1179
}
1181
1180
bool ToStringSubScriptHelper (const SigningProvider* arg, std::string& ret, const StringType type, const DescriptorCache* cache = nullptr ) const override
0 commit comments