Use getters instead of Satoshi-style access methods
[NovacoinLibrary.git] / Novacoin / CScript.cs
index d9938fd..565b6a2 100644 (file)
@@ -240,31 +240,37 @@ namespace Novacoin
         /// Quick test for pay-to-script-hash CScripts
         /// </summary>
         /// <returns>Checking result</returns>
-        public bool IsPayToScriptHash()
+        public bool IsPayToScriptHash
         {
-            // Sender provides redeem script hash, receiver provides signature list and redeem script
-            // OP_HASH160 20 [20 byte hash] OP_EQUAL
-            return (codeBytes.Count() == 23 &&
-                    codeBytes[0] == (byte)opcodetype.OP_HASH160 &&
-                    codeBytes[1] == 0x14 && // 20 bytes hash length prefix
-                    codeBytes[22] == (byte)opcodetype.OP_EQUAL);
+            get
+            {
+                // Sender provides redeem script hash, receiver provides signature list and redeem script
+                // OP_HASH160 20 [20 byte hash] OP_EQUAL
+                return (codeBytes.Count() == 23 &&
+                        codeBytes[0] == (byte)opcodetype.OP_HASH160 &&
+                        codeBytes[1] == 0x14 && // 20 bytes hash length prefix
+                        codeBytes[22] == (byte)opcodetype.OP_EQUAL);
+            }
         }
 
         /// <summary>
         /// Quick test for pay-to-pubkeyhash CScripts
         /// </summary>
         /// <returns>Checking result</returns>
-        public bool IsPayToPubKeyHash()
+        public bool IsPayToPubKeyHash
         {
-            // Sender provides hash of pubkey, receiver provides signature and pubkey
-            // OP_DUP OP_HASH160 20 [20 byte hash] OP_EQUALVERIFY OP_CHECKSIG
-
-            return (codeBytes.Count == 25 &&
-                    codeBytes[0] == (byte) opcodetype.OP_DUP &&
-                    codeBytes[1] == (byte)opcodetype.OP_HASH160 &&
-                    codeBytes[2] == 0x14 && // 20 bytes hash length prefix
-                    codeBytes[23] == (byte)opcodetype.OP_EQUALVERIFY &&
-                    codeBytes[24] == (byte)opcodetype.OP_CHECKSIG);
+            get
+            {
+                // Sender provides hash of pubkey, receiver provides signature and pubkey
+                // OP_DUP OP_HASH160 20 [20 byte hash] OP_EQUALVERIFY OP_CHECKSIG
+
+                return (codeBytes.Count == 25 &&
+                        codeBytes[0] == (byte)opcodetype.OP_DUP &&
+                        codeBytes[1] == (byte)opcodetype.OP_HASH160 &&
+                        codeBytes[2] == 0x14 && // 20 bytes hash length prefix
+                        codeBytes[23] == (byte)opcodetype.OP_EQUALVERIFY &&
+                        codeBytes[24] == (byte)opcodetype.OP_CHECKSIG);
+            }
         }
 
         /// <summary>
@@ -317,7 +323,7 @@ namespace Novacoin
         /// <returns>SigOps count</returns>
         public int GetSigOpCount(CScript scriptSig)
         {
-            if (!IsPayToScriptHash())
+            if (!IsPayToScriptHash)
             {
                 return GetSigOpCount(true);
             }
@@ -369,7 +375,7 @@ namespace Novacoin
 
             foreach (CPubKey key in keys)
             {
-                PushData(key.Public.ToList());
+                PushData(key.PublicBytes.ToList());
             }
             AddOp(ScriptCode.EncodeOP_N(keys.Count()));
             AddOp(opcodetype.OP_CHECKMULTISIG);