Use byte[] instead of IEnumerable<byte> if possible
[NovacoinLibrary.git] / Novacoin / CBlock.cs
index 7286622..3a5a36d 100644 (file)
@@ -1,4 +1,22 @@
-\feffusing System;
+\feff/**
+ *  Novacoin classes library
+ *  Copyright (C) 2015 Alex D. (balthazar.ad@gmail.com)
+
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU Affero General Public License as
+ *  published by the Free Software Foundation, either version 3 of the
+ *  License, or (at your option) any later version.
+
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Affero General Public License for more details.
+
+ *  You should have received a copy of the GNU Affero General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ using System;
 using System.Text;
 using System.Collections.Generic;
 
@@ -88,7 +106,7 @@ namespace Novacoin
                     }
 
                     txnouttype whichType;
-                    IList<IEnumerable<byte>> solutions;
+                    IList<byte[]> solutions;
 
                     if (!ScriptCode.Solver(vtx[1].vout[1].scriptPubKey, out whichType, out solutions))
                     {
@@ -130,12 +148,12 @@ namespace Novacoin
         {
             get
             {
-                List<byte> r = new List<byte>();
+                var r = new List<byte>();
 
                 r.AddRange(header.Bytes);
                 r.AddRange(VarInt.EncodeVarInt(vtx.LongLength)); // transactions count
 
-                foreach (CTransaction tx in vtx)
+                foreach (var tx in vtx)
                 {
                     r.AddRange(tx.Bytes);
                 }
@@ -149,11 +167,11 @@ namespace Novacoin
 
         public override string ToString()
         {
-            StringBuilder sb = new StringBuilder();
+            var sb = new StringBuilder();
 
             sb.AppendFormat("CBlock(\n header={0},\n", header.ToString());
 
-            foreach(CTransaction tx in vtx)
+            foreach(var tx in vtx)
             {
                 sb.AppendFormat("{0}", tx.ToString());
             }
@@ -164,8 +182,7 @@ namespace Novacoin
             }
 
             sb.Append(")");
-
-            // TODO
+            
             return sb.ToString();
         }
        }