aboutsummaryrefslogtreecommitdiff
path: root/src/outputtype.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2019-08-28 15:12:51 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2019-10-16 08:56:57 -0700
commite65e61c812df90a56e3ce4a8e76c4b746766f387 (patch)
tree787fa4b641ed0d640f96cf430092961e9d7b1b20 /src/outputtype.cpp
parentc34b88620dc8435b83e6744895f2ecd3c9ec8de7 (diff)
downloadbitcoin-e65e61c812df90a56e3ce4a8e76c4b746766f387.tar.xz
Add some general std::vector utility functions
Added are: * Vector(arg1,arg2,arg3,...) constructs a vector with the specified arguments as elements. The vector's type is derived from the arguments. If some of the arguments are rvalue references, they will be moved into place rather than copied (which can't be achieved using list initialization). * Cat(vector1,vector2) returns a concatenation of the two vectors, efficiently moving elements when relevant. Vector generalizes (and replaces) the Singleton function in src/descriptor.cpp, and Cat replaces the Cat function in bech32.cpp
Diffstat (limited to 'src/outputtype.cpp')
-rw-r--r--src/outputtype.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/outputtype.cpp b/src/outputtype.cpp
index bcaa05f4b6..5cc43898a7 100644
--- a/src/outputtype.cpp
+++ b/src/outputtype.cpp
@@ -10,6 +10,7 @@
#include <script/sign.h>
#include <script/signingprovider.h>
#include <script/standard.h>
+#include <util/vector.h>
#include <assert.h>
#include <string>
@@ -65,12 +66,13 @@ CTxDestination GetDestinationForKey(const CPubKey& key, OutputType type)
std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key)
{
PKHash keyid(key);
+ CTxDestination p2pkh{keyid};
if (key.IsCompressed()) {
CTxDestination segwit = WitnessV0KeyHash(keyid);
CTxDestination p2sh = ScriptHash(GetScriptForDestination(segwit));
- return std::vector<CTxDestination>{std::move(keyid), std::move(p2sh), std::move(segwit)};
+ return Vector(std::move(p2pkh), std::move(p2sh), std::move(segwit));
} else {
- return std::vector<CTxDestination>{std::move(keyid)};
+ return Vector(std::move(p2pkh));
}
}