X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=Novacoin%2FCScriptID.cs;h=9035de5dabbdb61ee3844792f13ae18e392341f6;hb=1dcac5faa2b1477034f82466ffb16170fa2e9bb6;hp=bd4dea53c13104f72f618ff58823b2b3059343e1;hpb=f1846d8b19cb53634c26d0618fcceaa6111e12d2;p=NovacoinLibrary.git diff --git a/Novacoin/CScriptID.cs b/Novacoin/CScriptID.cs index bd4dea5..9035de5 100644 --- a/Novacoin/CScriptID.cs +++ b/Novacoin/CScriptID.cs @@ -16,25 +16,35 @@ * along with this program. If not, see . */ -using System; -using System.Diagnostics.Contracts; - namespace Novacoin { - public class CScriptID : Hash160 + /// + /// Represents the script identifier. Internal value is calculated as Hash160(script). + /// + public class CScriptID : uint160 { - public CScriptID(Hash160 scriptHash) + #region Constructors + public CScriptID() : base() + { + } + + public CScriptID(CScriptID KeyID) : base(KeyID as uint160) { - _hashBytes = scriptHash; } - internal CScriptID(byte[] hashBytes) + public CScriptID(uint160 pubKeyHash) : base(pubKeyHash) { - Contract.Requires(hashBytes.Length == 20, "Your data doesn't seem like a hash160 of some value."); + } - _hashBytes = hashBytes; + public CScriptID(byte[] hashBytes) : base(hashBytes) + { } + #endregion + /// + /// Generate Pay-to-ScriptHash address + /// + /// Base58 formatted novacoin address public override string ToString() { return (new CNovacoinAddress(this)).ToString();