sharp-cryptonote-tool/BlockTemplate.cs

41 lines
1.0 KiB
C#

using System;
namespace sharp.cryptonote
{
public class BlockTemplate
{
public BlockTemplate(byte[] blob, UInt64 difficulty, UInt64 height, string prev_hash, Int64 reserved_offset, Int64 reserve_size)
{
this.Blob = blob;
this.Height = height;
this.Difficulty = difficulty;
this.PreviousHash = prev_hash;
this.ReservedOffset = reserved_offset;
this.ReserveSize = reserve_size;
}
public byte[] Blob { get; private set; }
public UInt64 Difficulty { get; private set; }
public UInt64 Height { get; private set; }
public Int64 ReservedOffset { get; private set; }
public Int64 ReserveSize { get; private set; }
public string PreviousHash { get; private set; }
public byte[] generateJobTemplate(byte[] jobbytes){
byte[] blob = new byte[this.Blob.Length];
if (jobbytes.Length > ReserveSize){
throw new ArgumentException("JobBytes bigger than reserved size!");
}
Array.Copy(this.Blob,blob,blob.Length);
Array.Copy(jobbytes, 0, blob, ReservedOffset, jobbytes.Length);
return blob;
}
}
}