diff options
author | MacroFake <falke.marco@gmail.com> | 2022-07-30 14:27:47 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-08-12 17:19:16 +0200 |
commit | fa3f15f2dd94ae597a66037f5928fe4e90fe099d (patch) | |
tree | 3f8bda3498fd454d53662ea48e4b140fe772c102 /src/script/signingprovider.cpp | |
parent | bf3f05f41d27a6be3730432aaa7e22e443f7cafa (diff) | |
download | bitcoin-fa3f15f2dd94ae597a66037f5928fe4e90fe099d.tar.xz |
refactor: Avoid copies in FlatSigningProvider Merge
Diffstat (limited to 'src/script/signingprovider.cpp')
-rw-r--r-- | src/script/signingprovider.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
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) |