diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2020-01-15 21:48:59 +0000 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2020-06-19 12:14:08 -0700 |
commit | 966a22d859db37b1775e2180e5be032fc4fdf483 (patch) | |
tree | adc7d5c50d425c31fb5fdde6420643b386ecae43 /src/script/standard.h | |
parent | f32c1e07fd6c174ff3f6406a619550d2f6c19360 (diff) |
Explicitly support conversion between equivalent hash types
ScriptHash <-> CScriptID
CKeyID -> PKHash
PKHash -> WitnessV0KeyHash
Diffstat (limited to 'src/script/standard.h')
-rw-r--r-- | src/script/standard.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/standard.h b/src/script/standard.h index 6c882e92a1..d235e6e173 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -18,6 +18,7 @@ static const bool DEFAULT_ACCEPT_DATACARRIER = true; class CKeyID; class CScript; +struct ScriptHash; /** A reference to a CScript: the Hash160 of its serialization (see script.h) */ class CScriptID : public uint160 @@ -26,6 +27,7 @@ public: CScriptID() : uint160() {} explicit CScriptID(const CScript& in); explicit CScriptID(const uint160& in) : uint160(in) {} + explicit CScriptID(const ScriptHash& in); }; /** @@ -78,6 +80,7 @@ struct PKHash : public uint160 PKHash() : uint160() {} explicit PKHash(const uint160& hash) : uint160(hash) {} explicit PKHash(const CPubKey& pubkey); + explicit PKHash(const CKeyID& pubkey_id); }; CKeyID ToKeyID(const PKHash& key_hash); @@ -91,6 +94,7 @@ struct ScriptHash : public uint160 explicit ScriptHash(const PKHash& hash) = delete; explicit ScriptHash(const uint160& hash) : uint160(hash) {} explicit ScriptHash(const CScript& script); + explicit ScriptHash(const CScriptID& script); }; struct WitnessV0ScriptHash : public uint256 @@ -105,6 +109,7 @@ struct WitnessV0KeyHash : public uint160 WitnessV0KeyHash() : uint160() {} explicit WitnessV0KeyHash(const uint160& hash) : uint160(hash) {} explicit WitnessV0KeyHash(const CPubKey& pubkey); + explicit WitnessV0KeyHash(const PKHash& pubkey_hash); }; CKeyID ToKeyID(const WitnessV0KeyHash& key_hash); |