mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-06 20:52:08 +02:00
sign: Add GetMuSig2ParticipantPubkeys to SigningProvider
This commit is contained in:
@@ -52,6 +52,11 @@ bool HidingSigningProvider::GetTaprootBuilder(const XOnlyPubKey& output_key, Tap
|
|||||||
{
|
{
|
||||||
return m_provider->GetTaprootBuilder(output_key, builder);
|
return m_provider->GetTaprootBuilder(output_key, builder);
|
||||||
}
|
}
|
||||||
|
std::vector<CPubKey> 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::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); }
|
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);
|
return LookupHelper(tr_trees, output_key, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<CPubKey> FlatSigningProvider::GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const
|
||||||
|
{
|
||||||
|
std::vector<CPubKey> participant_pubkeys;
|
||||||
|
LookupHelper(aggregate_pubkeys, pubkey, participant_pubkeys);
|
||||||
|
return participant_pubkeys;
|
||||||
|
}
|
||||||
|
|
||||||
FlatSigningProvider& FlatSigningProvider::Merge(FlatSigningProvider&& b)
|
FlatSigningProvider& FlatSigningProvider::Merge(FlatSigningProvider&& b)
|
||||||
{
|
{
|
||||||
scripts.merge(b.scripts);
|
scripts.merge(b.scripts);
|
||||||
@@ -89,6 +101,7 @@ FlatSigningProvider& FlatSigningProvider::Merge(FlatSigningProvider&& b)
|
|||||||
keys.merge(b.keys);
|
keys.merge(b.keys);
|
||||||
origins.merge(b.origins);
|
origins.merge(b.origins);
|
||||||
tr_trees.merge(b.tr_trees);
|
tr_trees.merge(b.tr_trees);
|
||||||
|
aggregate_pubkeys.merge(b.aggregate_pubkeys);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -161,6 +161,7 @@ public:
|
|||||||
virtual bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const { return false; }
|
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 GetTaprootSpendData(const XOnlyPubKey& output_key, TaprootSpendData& spenddata) const { return false; }
|
||||||
virtual bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const { return false; }
|
virtual bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const { return false; }
|
||||||
|
virtual std::vector<CPubKey> GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const { return {}; }
|
||||||
|
|
||||||
bool GetKeyByXOnly(const XOnlyPubKey& pubkey, CKey& key) const
|
bool GetKeyByXOnly(const XOnlyPubKey& pubkey, CKey& key) const
|
||||||
{
|
{
|
||||||
@@ -204,6 +205,7 @@ public:
|
|||||||
bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
|
bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
|
||||||
bool GetTaprootSpendData(const XOnlyPubKey& output_key, TaprootSpendData& spenddata) const override;
|
bool GetTaprootSpendData(const XOnlyPubKey& output_key, TaprootSpendData& spenddata) const override;
|
||||||
bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const override;
|
bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const override;
|
||||||
|
std::vector<CPubKey> GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FlatSigningProvider final : public SigningProvider
|
struct FlatSigningProvider final : public SigningProvider
|
||||||
@@ -213,6 +215,7 @@ struct FlatSigningProvider final : public SigningProvider
|
|||||||
std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>> origins;
|
std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>> origins;
|
||||||
std::map<CKeyID, CKey> keys;
|
std::map<CKeyID, CKey> keys;
|
||||||
std::map<XOnlyPubKey, TaprootBuilder> tr_trees; /** Map from output key to Taproot tree (which can then make the TaprootSpendData */
|
std::map<XOnlyPubKey, TaprootBuilder> tr_trees; /** Map from output key to Taproot tree (which can then make the TaprootSpendData */
|
||||||
|
std::map<CPubKey, std::vector<CPubKey>> aggregate_pubkeys; /** MuSig2 aggregate pubkeys */
|
||||||
|
|
||||||
bool GetCScript(const CScriptID& scriptid, CScript& script) const override;
|
bool GetCScript(const CScriptID& scriptid, CScript& script) const override;
|
||||||
bool GetPubKey(const CKeyID& keyid, CPubKey& pubkey) 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 GetKey(const CKeyID& keyid, CKey& key) const override;
|
||||||
bool GetTaprootSpendData(const XOnlyPubKey& output_key, TaprootSpendData& spenddata) const override;
|
bool GetTaprootSpendData(const XOnlyPubKey& output_key, TaprootSpendData& spenddata) const override;
|
||||||
bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const override;
|
bool GetTaprootBuilder(const XOnlyPubKey& output_key, TaprootBuilder& builder) const override;
|
||||||
|
std::vector<CPubKey> GetMuSig2ParticipantPubkeys(const CPubKey& pubkey) const override;
|
||||||
|
|
||||||
FlatSigningProvider& Merge(FlatSigningProvider&& b) LIFETIMEBOUND;
|
FlatSigningProvider& Merge(FlatSigningProvider&& b) LIFETIMEBOUND;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user