IsPayToScriptHash
authorCryptoManiac <balthazar@yandex.ru>
Sat, 15 Aug 2015 19:29:48 +0000 (22:29 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Sat, 15 Aug 2015 19:29:48 +0000 (22:29 +0300)
Novacoin/CScript.cs

index 45381f9..8a223e4 100644 (file)
@@ -236,6 +236,17 @@ namespace Novacoin
             return true;
         }
 
+        /// <summary>
+        /// Quick test for pay-to-script-hash CScripts
+        /// </summary>
+        /// <returns>Checking result</returns>
+        public bool IsPayToScriptHash()
+        {
+            return (codeBytes.Count() == 23 &&
+                    codeBytes[0] == (byte)opcodetype.OP_HASH160 &&
+                    codeBytes[1] == 0x14 &&
+                    codeBytes[22] == (byte)opcodetype.OP_EQUAL);
+        }
 
         /// <summary>
         /// Disassemble current script code