diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/descriptor.cpp | 2 | ||||
-rw-r--r-- | src/script/signingprovider.cpp | 22 | ||||
-rw-r--r-- | src/script/signingprovider.h | 5 |
3 files changed, 12 insertions, 17 deletions
diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 9bcbe1ceef..8ace9c3136 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -644,7 +644,7 @@ public: assert(outscripts.size() == 1); subscripts.emplace_back(std::move(outscripts[0])); } - out = Merge(std::move(out), std::move(subprovider)); + out.Merge(std::move(subprovider)); std::vector<CPubKey> pubkeys; pubkeys.reserve(entries.size()); diff --git a/src/script/signingprovider.cpp b/src/script/signingprovider.cpp index c624a17628..a82a8b252a 100644 --- a/src/script/signingprovider.cpp +++ b/src/script/signingprovider.cpp @@ -77,20 +77,14 @@ bool FlatSigningProvider::GetTaprootBuilder(const XOnlyPubKey& output_key, Tapro return LookupHelper(tr_trees, output_key, builder); } -FlatSigningProvider Merge(const FlatSigningProvider& a, const FlatSigningProvider& b) -{ - FlatSigningProvider ret; - ret.scripts = a.scripts; - ret.scripts.insert(b.scripts.begin(), b.scripts.end()); - ret.pubkeys = a.pubkeys; - ret.pubkeys.insert(b.pubkeys.begin(), b.pubkeys.end()); - ret.keys = a.keys; - ret.keys.insert(b.keys.begin(), b.keys.end()); - ret.origins = a.origins; - ret.origins.insert(b.origins.begin(), b.origins.end()); - ret.tr_trees = a.tr_trees; - ret.tr_trees.insert(b.tr_trees.begin(), b.tr_trees.end()); - return ret; +FlatSigningProvider& FlatSigningProvider::Merge(FlatSigningProvider&& b) +{ + scripts.merge(b.scripts); + pubkeys.merge(b.pubkeys); + keys.merge(b.keys); + origins.merge(b.origins); + tr_trees.merge(b.tr_trees); + return *this; } void FillableSigningProvider::ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey) diff --git a/src/script/signingprovider.h b/src/script/signingprovider.h index 792cc903f2..2d4234ea0b 100644 --- a/src/script/signingprovider.h +++ b/src/script/signingprovider.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_SCRIPT_SIGNINGPROVIDER_H #define BITCOIN_SCRIPT_SIGNINGPROVIDER_H +#include <attributes.h> #include <key.h> #include <pubkey.h> #include <script/keyorigin.h> @@ -85,9 +86,9 @@ 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; -}; -FlatSigningProvider Merge(const FlatSigningProvider& a, const FlatSigningProvider& b); + FlatSigningProvider& Merge(FlatSigningProvider&& b) LIFETIMEBOUND; +}; /** Fillable signing provider that keeps keys in an address->secret map */ class FillableSigningProvider : public SigningProvider |