Пример #1
0
        /// <summary>
        /// Raw script data
        /// </summary>
        /// <param name="prefix"> Tells whether to include script size in data </param>
        /// <returns> Byte array with script data </returns>
        public byte[] ToData(bool prefix)
        {
            int scriptSize = 0;
            var scriptData = new NativeBuffer(ScriptNative.kth_chain_script_to_data(nativeInstance_, prefix? 1:0, ref scriptSize));

            return(scriptData.CopyToManagedArray(scriptSize));
        }
Пример #2
0
 /// <summary>
 /// Translate operations in the script to a string.
 /// </summary>
 /// <param name="activeForks"> Tells which rule is active. </param>
 /// <returns> Human readable script. </returns>
 public string ToString(UInt32 activeForks)
 {
     using (NativeString scriptString = new NativeString(ScriptNative.chain_script_to_string(nativeInstance_, activeForks)))
     {
         return(scriptString.ToString());
     }
 }
Пример #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         //Release managed resources and call Dispose for member variables
     }
     //Release unmanaged resources
     if (ownsNativeObject_)
     {
         //Logger.Log("Destroying script " + nativeInstance_.ToString("X") + " ...");
         ScriptNative.kth_chain_script_destruct(nativeInstance_);
         //Logger.Log("Script " + nativeInstance_.ToString("X") + " destroyed!");
     }
 }
Пример #4
0
 /// <summary>
 /// Amount of signature operations in the script.
 /// </summary>
 /// <param name="embedded"> Iif true, consider this an embedded script. </param>
 /// <returns> Sigops count. </returns>
 public UInt64 GetSigOps(bool embedded)
 {
     return((UInt64)ScriptNative.kth_chain_script_sigops(nativeInstance_, Helper.BoolToC(embedded)));
 }
Пример #5
0
 /// <summary>
 /// Count the sigops in the embedded script using BIP16 rules.
 /// </summary>
 /// <param name="prevOutScript"> Reference to previous output script. </param>
 /// <returns> Embedded sigops count. </returns>
 public UInt64 GetEmbeddedSigOps(Script prevOutScript)
 {
     return((UInt64)ScriptNative.kth_chain_script_embedded_sigops(nativeInstance_, prevOutScript.nativeInstance_));
 }
Пример #6
0
 /// <summary>
 /// Amount of signature operations in the script.
 /// </summary>
 /// <param name="embedded"> Iif true, consider this an embedded script. </param>
 /// <returns> Sigops count. </returns>
 public UInt64 GetSigOps(bool embedded)
 {
     return((UInt64)ScriptNative.chain_script_sigops(nativeInstance_, embedded ? 1 : 0));
 }