aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/script/standard.cpp5
-rw-r--r--src/script/standard.h5
2 files changed, 10 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)
{
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);