aboutsummaryrefslogtreecommitdiff
path: root/src/script/standard.cpp
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2020-01-15 21:48:59 +0000
committerBen Woosley <ben.woosley@gmail.com>2020-06-19 12:14:08 -0700
commit966a22d859db37b1775e2180e5be032fc4fdf483 (patch)
treeadc7d5c50d425c31fb5fdde6420643b386ecae43 /src/script/standard.cpp
parentf32c1e07fd6c174ff3f6406a619550d2f6c19360 (diff)
downloadbitcoin-966a22d859db37b1775e2180e5be032fc4fdf483.tar.xz
Explicitly support conversion between equivalent hash types
ScriptHash <-> CScriptID CKeyID -> PKHash PKHash -> WitnessV0KeyHash
Diffstat (limited to 'src/script/standard.cpp')
-rw-r--r--src/script/standard.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/standard.cpp b/src/script/standard.cpp
index a47ccef842..f8bfc3b69c 100644
--- a/src/script/standard.cpp
+++ b/src/script/standard.cpp
@@ -17,11 +17,16 @@ bool fAcceptDatacarrier = DEFAULT_ACCEPT_DATACARRIER;
unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY;
CScriptID::CScriptID(const CScript& in) : uint160(Hash160(in.begin(), in.end())) {}
+CScriptID::CScriptID(const ScriptHash& in) : uint160(static_cast<uint160>(in)) {}
ScriptHash::ScriptHash(const CScript& in) : uint160(Hash160(in.begin(), in.end())) {}
+ScriptHash::ScriptHash(const CScriptID& in) : uint160(static_cast<uint160>(in)) {}
PKHash::PKHash(const CPubKey& pubkey) : uint160(pubkey.GetID()) {}
+PKHash::PKHash(const CKeyID& pubkey_id) : uint160(pubkey_id) {}
+
WitnessV0KeyHash::WitnessV0KeyHash(const CPubKey& pubkey) : uint160(pubkey.GetID()) {}
+WitnessV0KeyHash::WitnessV0KeyHash(const PKHash& pubkey_hash) : uint160(static_cast<uint160>(pubkey_hash)) {}
CKeyID ToKeyID(const PKHash& key_hash)
{