Cosmetic changes.
[NovacoinLibrary.git] / Novacoin / COutPoint.cs
index a9a347c..9e628e9 100644 (file)
@@ -19,6 +19,7 @@
 using System;
 using System.Collections.Generic;
 using System.Diagnostics.Contracts;
+using System.IO;
 using System.Text;
 
 namespace Novacoin
@@ -73,17 +74,23 @@ namespace Novacoin
 
         public static implicit operator byte[] (COutPoint o)
         {
-            var r = new List<byte>();
-            r.AddRange((byte[])o.hash);
-            r.AddRange(BitConverter.GetBytes(o.n));
+            var stream = new MemoryStream();
+            var writer = new BinaryWriter(stream);
 
-            return r.ToArray();
+            writer.Write(o.hash);
+            writer.Write(o.n);
+
+            var outBytes = stream.ToArray();
+
+            writer.Close();
+
+            return outBytes;
         }
 
         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();
         }