Exemplo n.º 1
0
        /// <summary>
        /// Check existance of item with provided ScriptID
        /// </summary>
        /// <param name="scriptID">Hash160 of script code.</param>
        /// <returns>Checking result</returns>
        public bool HaveScript(CScriptID scriptID)
        {
            var QueryGet = dbConn.Query<NumQuery>("select count([ItemID]) from [ScriptStorage] where [ScriptID] = ?", (byte[])scriptID);

            return QueryGet.First().Num == 1;
        }
 /// <summary>
 /// Initialize new instance of SCRIPT_ADDRESS
 /// </summary>
 /// <param name="keyID">CScriptID instance</param>
 public CNovacoinAddress(CScriptID scriptID)
 {
     nVersion = (byte)AddrType.SCRIPT_ADDRESS;
     addrData = scriptID;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Get redeem script from database.
        /// </summary>
        /// <param name="scriptID">Script ID, evaluated as Hash160(script code).</param>
        /// <param name="script">Instance of CScript</param>
        /// <returns>Result</returns>
        public bool GetScript(CScriptID scriptID, out CScript script)
        {
            var QueryGet = dbConn.Query<ScriptStorageItem>("select * from [ScriptStorage] where [ScriptID] = ?", (byte[])scriptID);

            if (QueryGet.Count() == 1)
            {
                script = new CScript(QueryGet.First().ScriptCode);
                return true;
            }

            script = null;
            return false;
        }