Use getters instead of Satoshi-style access methods
[NovacoinLibrary.git] / Novacoin / ScriptCode.cs
index 4aad33e..2326c01 100644 (file)
@@ -656,24 +656,24 @@ namespace Novacoin
             // There are shortcuts for pay-to-script-hash and pay-to-pubkey-hash, which are more constrained than the other types:
 
             // It is always OP_HASH160 20 [20 byte hash] OP_EQUAL
-            if (scriptPubKey.IsPayToScriptHash())
+            if (scriptPubKey.IsPayToScriptHash)
             {
                 typeRet = txnouttype.TX_SCRIPTHASH;
 
                 // Take 20 bytes with offset of 2 bytes
-                IEnumerable<byte> hashBytes = scriptPubKey.Enumerable.Skip(2).Take(20);
+                IEnumerable<byte> hashBytes = scriptPubKey.Bytes.Skip(2).Take(20);
                 solutions.Add(hashBytes);
 
                 return true;
             }
 
             // It is always OP_DUP OP_HASH160 20 [20 byte hash] OP_EQUALVERIFY OP_CHECKSIG
-            if (scriptPubKey.IsPayToPubKeyHash())
+            if (scriptPubKey.IsPayToPubKeyHash)
             {
                 typeRet = txnouttype.TX_PUBKEYHASH;
 
                 // Take 20 bytes with offset of 3 bytes
-                IEnumerable<byte> hashBytes = scriptPubKey.Enumerable.Skip(3).Take(20);
+                IEnumerable<byte> hashBytes = scriptPubKey.Bytes.Skip(3).Take(20);
                 solutions.Add(hashBytes);
 
                 return true;
@@ -711,8 +711,8 @@ namespace Novacoin
 
             foreach (Tuple<txnouttype, IEnumerable<byte>> templateTuple in templateTuples)
             {
-                CScript script2 = new CScript(templateTuple.Item2);
                 CScript script1 = scriptPubKey;
+                CScript script2 = new CScript(templateTuple.Item2);
 
                 opcodetype opcode1, opcode2;
 
@@ -722,12 +722,12 @@ namespace Novacoin
 
                 IEnumerable<byte> args1, args2;
 
-                byte last1 = script1.Enumerable.Last();
-                byte last2 = script2.Enumerable.Last();
+                byte last1 = script1.Bytes.Last();
+                byte last2 = script2.Bytes.Last();
 
                 while (true)
                 {
-                    if (wl1.GetItem() == last1 && wl2.GetItem() == last2)
+                    if (wl1.GetCurrentItem() == last1 && wl2.GetCurrentItem() == last2)
                     {
                         // Found a match
                         typeRet = templateTuple.Item1;
@@ -807,7 +807,7 @@ namespace Novacoin
                             break;
                         }
                     }
-                    else if (opcode1 != opcode2 || args1.SequenceEqual(args2))
+                    else if (opcode1 != opcode2 || !args1.SequenceEqual(args2))
                     {
                         // Others must match exactly
                         break;