public uint nNonce { get; set; }
/// <summary>
+ /// Next block hash.
+ /// </summary>
+ public byte[] nextHash { get; set; }
+
+ /// <summary>
/// Block type flags
/// </summary>
public BlockType BlockTypeFlag { get; set; }
public byte nEntropyBit { get; set; }
/// <summary>
+ /// Proof-of-Stake hash
+ /// </summary>
+ public byte[] hashProofOfStake { get; set; }
+
+ /// <summary>
/// Block height
/// </summary>
public uint nHeight { get; set; }
/// <summary>
/// Previous block cursor
/// </summary>
- public public CBlockStoreItem prev {
+ public CBlockStoreItem prev {
get { return CBlockStore.Instance.GetCursor(prevHash); }
}
/// <summary>
- /// STake modifier generation flag
+ /// Next block cursor
/// </summary>
- public bool GeneratedStakeModifier
+ public CBlockStoreItem next
+ {
+ get { return CBlockStore.Instance.GetCursor(nextHash); }
+ }
+
+ bool IsInMainChain
+ {
+ get { return (next != null); }
+ }
+
+
+ /// <summary>
+ /// STake modifier generation flag
+ /// </summary>
+ public bool GeneratedStakeModifier
{
get { return (BlockTypeFlag & BlockType.BLOCK_STAKE_MODIFIER) != 0; }
}
+ public uint StakeEntropyBit
+ {
+ get { return ((uint)(BlockTypeFlag & BlockType.BLOCK_STAKE_ENTROPY) >> 1); }
+ }
+
/// <summary>
/// Sets stake modifier and flag.
/// </summary>
// TODO: compute stake modifier
// Add to index
- itemTemplate.BlockTypeFlag = block.IsProofOfStake ? BlockType.PROOF_OF_STAKE : BlockType.PROOF_OF_WORK;
+ if (block.IsProofOfStake)
+ {
+ itemTemplate.SetProofOfStake();
+ }
if (!itemTemplate.WriteToFile(ref writer, ref block))
{