using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
+using System.IO;
using System.Text;
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();
}