using System;
using System.Text;
using System.Collections.Generic;
namespace Novacoin
{
///
/// Block header
///
public class CBlockHeader
{
///
/// Version of block schema.
///
public uint nVersion = 6;
///
/// Previous block hash.
///
public Hash256 prevHash = new Hash256();
///
/// Merkle root hash.
///
public Hash256 merkleRoot = new Hash256();
///
/// Block timestamp.
///
public uint nTime = 0;
///
/// Compressed difficulty representation.
///
public uint nBits = 0;
///
/// Nonce counter.
///
public uint nNonce = 0;
///
/// Initialize an empty instance
///
public CBlockHeader ()
{
}
///
/// Convert current block header instance into sequence of bytes
///
/// Byte sequence
public IList Bytes
{
get
{
List r = new List();
r.AddRange(BitConverter.GetBytes(nVersion));
r.AddRange(prevHash.hashBytes);
r.AddRange(merkleRoot.hashBytes);
r.AddRange(BitConverter.GetBytes(nTime));
r.AddRange(BitConverter.GetBytes(nBits));
r.AddRange(BitConverter.GetBytes(nNonce));
return r;
}
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("CBlockHeader(nVersion={0}, prevHash={1}, merkleRoot={2}, nTime={3}, nBits={4}, nNonce={5})", nVersion, prevHash.ToString(), merkleRoot.ToString(), nTime, nBits, nNonce);
return sb.ToString();
}
}
}