public void add(Block block) { if (Chain.Count > 0) { block.PrevBlockHash = Chain.Last().Pow; block.BlockNumber = (Chain.Count + 1).ToString(); } else { block.PrevBlockHash = EMPTY_HASH; block.BlockNumber = "1"; } block.Difficulty = DEFAULT_DIFFICALTY; block.recalculate(); Chain.Add(block); }
/// <summary> /// Get the most recent block in the chain. /// </summary> /// <returns>The most recent block in the chain.</returns> public Block GetLastBlock() => Chain.Last();