/// <summary> /// Get the Nth transaction hash from the block. /// </summary> /// <param name="n">Zerp-based index.</param> /// <returns> Transaction hash in 32 byte array format. </returns> public byte[] GetNthHash(int n) { var managedHash = new hash_t(); MerkleBlockNative.kth_chain_merkle_block_hash_nth_out(nativeInstance_, (UIntPtr)n, ref managedHash); return(managedHash.hash); }
protected virtual void Dispose(bool disposing) { if (disposing) { //Release managed resources and call Dispose for member variables header_.Dispose(); } //Release unmanaged resources //Logger.Log("Destroying merkle block " + nativeInstance_.ToString("X") + " ..."); MerkleBlockNative.kth_chain_merkle_block_destruct(nativeInstance_); //Logger.Log("Merkle block " + nativeInstance_.ToString("X") + " destroyed!"); }
internal MerkleBlock(IntPtr nativeInstance) { nativeInstance_ = nativeInstance; header_ = new Header(MerkleBlockNative.kth_chain_merkle_block_header(nativeInstance_), false); }
/// <summary> /// Delete all the data inside the block. /// </summary> public void Reset() { MerkleBlockNative.kth_chain_merkle_block_reset(nativeInstance_); }
/// <summary> /// Block size in bytes (as a Merkle block, not as a full block). /// </summary> /// <param name="version"> Protocol version to consider when calculating size. </param> /// <returns> Size in bytes. </returns> public UInt64 GetSerializedSize(UInt32 version) { return((UInt64)MerkleBlockNative.kth_chain_merkle_block_serialized_size(nativeInstance_, version)); }