diff --git a/src/script/signingprovider.cpp b/src/script/signingprovider.cpp index 07a1956eabc..792796b0f14 100644 --- a/src/script/signingprovider.cpp +++ b/src/script/signingprovider.cpp @@ -52,6 +52,11 @@ bool HidingSigningProvider::GetTaprootBuilder(const XOnlyPubKey& output_key, Tap { return m_provider->GetTaprootBuilder(output_key, builder); } +std::vector HidingSigningProvider::GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const +{ + if (m_hide_origin) return {}; + return m_provider->GetMuSig2ParticipantPubkeys(pubkey); +} bool FlatSigningProvider::GetCScript(const CScriptID& scriptid, CScript& script) const { return LookupHelper(scripts, scriptid, script); } bool FlatSigningProvider::GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const { return LookupHelper(pubkeys, keyid, pubkey); } @@ -82,6 +87,13 @@ bool FlatSigningProvider::GetTaprootBuilder(const XOnlyPubKey& output_key, Tapro return LookupHelper(tr_trees, output_key, builder); } +std::vector FlatSigningProvider::GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const +{ + std::vector participant_pubkeys; + LookupHelper(aggregate_pubkeys, pubkey, participant_pubkeys); + return participant_pubkeys; +} + FlatSigningProvider& FlatSigningProvider::Merge(FlatSigningProvider&& b) { scripts.merge(b.scripts); @@ -89,6 +101,7 @@ FlatSigningProvider& FlatSigningProvider::Merge(FlatSigningProvider&& b) keys.merge(b.keys); origins.merge(b.origins); tr_trees.merge(b.tr_trees); + aggregate_pubkeys.merge(b.aggregate_pubkeys); return *this; } diff --git a/src/script/signingprovider.h b/src/script/signingprovider.h index f4c823be393..1da58bf6f92 100644 --- a/src/script/signingprovider.h +++ b/src/script/signingprovider.h @@ -161,6 +161,7 @@ public: virtual bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const { return false; } virtual bool GetTaprootSpendData(const XOnlyPubKey& output_key, TaprootSpendData& spenddata) const { return false; } virtual bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const { return false; } + virtual std::vector GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const { return {}; } bool GetKeyByXOnly(const XOnlyPubKey& pubkey, CKey& key) const { @@ -204,6 +205,7 @@ public: bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override; bool GetTaprootSpendData(const XOnlyPubKey& output_key, TaprootSpendData& spenddata) const override; bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const override; + std::vector GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const override; }; struct FlatSigningProvider final : public SigningProvider @@ -213,6 +215,7 @@ struct FlatSigningProvider final : public SigningProvider std::map> origins; std::map keys; std::map tr_trees; /** Map from output key to Taproot tree (which can then make the TaprootSpendData */ + std::map> aggregate_pubkeys; /** MuSig2 aggregate pubkeys */ bool GetCScript(const CScriptID& scriptid, CScript& script) const override; bool GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const override; @@ -221,6 +224,7 @@ struct FlatSigningProvider final : public SigningProvider bool GetKey(const CKeyID& keyid, CKey& key) const override; bool GetTaprootSpendData(const XOnlyPubKey& output_key, TaprootSpendData& spenddata) const override; bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const override; + std::vector GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const override; FlatSigningProvider& Merge(FlatSigningProvider&& b) LIFETIMEBOUND; };