X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=Novacoin%2FCOutPoint.cs;h=09d0690a1d7b5428f6c8a7539a00b55414ad82d7;hb=1dcac5faa2b1477034f82466ffb16170fa2e9bb6;hp=ddb40e8cfce9cc080c26d40aca9f30663add746e;hpb=be9d844557911f95165d2c9875c4f5b2822cfc92;p=NovacoinLibrary.git diff --git a/Novacoin/COutPoint.cs b/Novacoin/COutPoint.cs index ddb40e8..09d0690 100644 --- a/Novacoin/COutPoint.cs +++ b/Novacoin/COutPoint.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.IO; +using System.Linq; using System.Text; namespace Novacoin @@ -29,7 +30,7 @@ namespace Novacoin /// /// Hash of parent transaction. /// - public Hash256 hash; + public uint256 hash; /// /// Parent input number. @@ -43,11 +44,11 @@ namespace Novacoin public COutPoint() { - hash = new Hash256(); + hash = new uint256(); n = uint.MaxValue; } - public COutPoint(Hash256 hashIn, uint nIn) + public COutPoint(uint256 hashIn, uint nIn) { hash = hashIn; n = nIn; @@ -55,7 +56,7 @@ namespace Novacoin public COutPoint(COutPoint o) { - hash = new Hash256(o.hash); + hash = o.hash; n = o.n; } @@ -63,13 +64,13 @@ namespace Novacoin { Contract.Requires(bytes.Length == 36, "Any valid outpoint reference data item is exactly 36 bytes long."); - hash = new Hash256(bytes); + hash = bytes.Take(32).ToArray(); n = BitConverter.ToUInt32(bytes, 32); } public bool IsNull { - get { return hash.IsZero && n == uint.MaxValue; } + get { return !hash && n == uint.MaxValue; } } public static implicit operator byte[] (COutPoint o) @@ -90,7 +91,7 @@ namespace Novacoin public override string ToString() { var sb = new StringBuilder(); - sb.AppendFormat("COutPoint({0}, {1})", hash.ToString(), n); + sb.AppendFormat("COutPoint({0}, {1})", hash, n); return sb.ToString(); }