diff options
Diffstat (limited to 'src/key.h')
-rw-r--r-- | src/key.h | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -44,6 +44,23 @@ public: explicit key_error(const std::string& str) : std::runtime_error(str) {} }; +/** A reference to a CKey: the Hash160 of its serialized public key */ +class CKeyID : public uint160 +{ +public: + CKeyID() : uint160(0) { } + CKeyID(const uint160 &in) : uint160(in) { } +}; + +/** A reference to a CScript: the Hash160 of its serialization (see script.h) */ +class CScriptID : public uint160 +{ +public: + CScriptID() : uint160(0) { } + CScriptID(const uint160 &in) : uint160(in) { } +}; + +/** An encapsulated public key. */ class CPubKey { private: std::vector<unsigned char> vchPubKey; @@ -60,8 +77,8 @@ public: READWRITE(vchPubKey); ) - uint160 GetID() const { - return Hash160(vchPubKey); + CKeyID GetID() const { + return CKeyID(Hash160(vchPubKey)); } uint256 GetHash() const { @@ -72,6 +89,10 @@ public: return vchPubKey.size() == 33 || vchPubKey.size() == 65; } + bool IsCompressed() const { + return vchPubKey.size() == 33; + } + std::vector<unsigned char> Raw() const { return vchPubKey; } |