aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2020-01-14 23:46:14 -0800
committerBen Woosley <ben.woosley@gmail.com>2020-06-19 12:14:07 -0700
commita9e451f144480d7b170e49087df162989d31cd20 (patch)
treea50496593555392d0c996311f65026dc6582a737 /src/script
parent3fcc46812334074d2c77a6233e8a961cd0785872 (diff)
Convert CPubKey to WitnessV0KeyHash directly
The round-tripping through PKHash has no effect, and is potentially misleading as such.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/standard.cpp1
-rw-r--r--src/script/standard.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/script/standard.cpp b/src/script/standard.cpp
index b6ee6117d9..3e0a9e2304 100644
--- a/src/script/standard.cpp
+++ b/src/script/standard.cpp
@@ -21,6 +21,7 @@ CScriptID::CScriptID(const CScript& in) : uint160(Hash160(in.begin(), in.end()))
ScriptHash::ScriptHash(const CScript& in) : uint160(Hash160(in.begin(), in.end())) {}
PKHash::PKHash(const CPubKey& pubkey) : uint160(pubkey.GetID()) {}
+WitnessV0KeyHash::WitnessV0KeyHash(const CPubKey& pubkey) : uint160(pubkey.GetID()) {}
WitnessV0ScriptHash::WitnessV0ScriptHash(const CScript& in)
{
diff --git a/src/script/standard.h b/src/script/standard.h
index 7c74d05be5..382d8d002b 100644
--- a/src/script/standard.h
+++ b/src/script/standard.h
@@ -103,6 +103,7 @@ struct WitnessV0KeyHash : public uint160
{
WitnessV0KeyHash() : uint160() {}
explicit WitnessV0KeyHash(const uint160& hash) : uint160(hash) {}
+ explicit WitnessV0KeyHash(const CPubKey& pubkey);
};
//! CTxDestination subtype to encode any future Witness version