mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#15263: Descriptor expansions only need pubkey entries for PKH/WPKH
This commit is contained in:
parent
b866be5f04
commit
c1ae9093e2
@ -227,7 +227,7 @@ protected:
|
|||||||
* @param pubkeys The evaluations of the m_pubkey_args field.
|
* @param pubkeys The evaluations of the m_pubkey_args field.
|
||||||
* @param script The evaluation of m_script_arg (or nullptr when m_script_arg is nullptr).
|
* @param script The evaluation of m_script_arg (or nullptr when m_script_arg is nullptr).
|
||||||
* @param out A FlatSigningProvider to put scripts or public keys in that are necessary to the solver.
|
* @param out A FlatSigningProvider to put scripts or public keys in that are necessary to the solver.
|
||||||
* The script and pubkeys argument to this function are automatically added.
|
* The script arguments to this function are automatically added, as is the origin info of the provided pubkeys.
|
||||||
* @return A vector with scriptPubKeys for this descriptor.
|
* @return A vector with scriptPubKeys for this descriptor.
|
||||||
*/
|
*/
|
||||||
virtual std::vector<CScript> MakeScripts(const std::vector<CPubKey>& pubkeys, const CScript* script, FlatSigningProvider& out) const = 0;
|
virtual std::vector<CScript> MakeScripts(const std::vector<CPubKey>& pubkeys, const CScript* script, FlatSigningProvider& out) const = 0;
|
||||||
@ -323,7 +323,6 @@ public:
|
|||||||
for (auto& entry : entries) {
|
for (auto& entry : entries) {
|
||||||
pubkeys.push_back(entry.first);
|
pubkeys.push_back(entry.first);
|
||||||
out.origins.emplace(entry.first.GetID(), std::move(entry.second));
|
out.origins.emplace(entry.first.GetID(), std::move(entry.second));
|
||||||
out.pubkeys.emplace(entry.first.GetID(), entry.first);
|
|
||||||
}
|
}
|
||||||
if (m_script_arg) {
|
if (m_script_arg) {
|
||||||
for (const auto& subscript : subscripts) {
|
for (const auto& subscript : subscripts) {
|
||||||
@ -397,7 +396,12 @@ public:
|
|||||||
class PKHDescriptor final : public DescriptorImpl
|
class PKHDescriptor final : public DescriptorImpl
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::vector<CScript> MakeScripts(const std::vector<CPubKey>& keys, const CScript*, FlatSigningProvider&) const override { return Singleton(GetScriptForDestination(keys[0].GetID())); }
|
std::vector<CScript> MakeScripts(const std::vector<CPubKey>& keys, const CScript*, FlatSigningProvider& out) const override
|
||||||
|
{
|
||||||
|
CKeyID id = keys[0].GetID();
|
||||||
|
out.pubkeys.emplace(id, keys[0]);
|
||||||
|
return Singleton(GetScriptForDestination(id));
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
PKHDescriptor(std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Singleton(std::move(prov)), {}, "pkh") {}
|
PKHDescriptor(std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Singleton(std::move(prov)), {}, "pkh") {}
|
||||||
};
|
};
|
||||||
@ -430,6 +434,7 @@ protected:
|
|||||||
{
|
{
|
||||||
std::vector<CScript> ret;
|
std::vector<CScript> ret;
|
||||||
CKeyID id = keys[0].GetID();
|
CKeyID id = keys[0].GetID();
|
||||||
|
out.pubkeys.emplace(id, keys[0]);
|
||||||
ret.emplace_back(GetScriptForRawPubKey(keys[0])); // P2PK
|
ret.emplace_back(GetScriptForRawPubKey(keys[0])); // P2PK
|
||||||
if (keys[0].IsCompressed()) {
|
if (keys[0].IsCompressed()) {
|
||||||
CScript p2wpkh = GetScriptForDestination(id);
|
CScript p2wpkh = GetScriptForDestination(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user