Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the ChainedBlocksDataBytes #338

Merged
merged 1 commit into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/Blockcore/Consensus/Chain/ChainedHeaderTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ internal interface IChainedHeaderTree
/// <summary>Total amount of unconsumed blocks.</summary>
long UnconsumedBlocksCount { get; }

/// <summary>Total size of ChainedHeaders data in bytes.</summary>
long ChainedBlocksDataBytes { get; }

/// <summary>
/// Initialize the tree with consensus tip.
/// </summary>
Expand Down Expand Up @@ -183,9 +180,6 @@ internal class ChainedHeaderTree : IChainedHeaderTree
/// <inheritdoc />
public long UnconsumedBlocksCount { get; private set; }

/// <inheritdoc />
public long ChainedBlocksDataBytes { get; private set; }

/// <summary>A special peer identifier that represents our local node.</summary>
internal const int LocalPeerId = -1;

Expand Down Expand Up @@ -252,7 +246,6 @@ public void Initialize(ChainedHeader consensusTip)
{
current.Previous.Next.Add(current);
this.chainedHeadersByHash.Add(current.HashBlock, current);
this.ChainedBlocksDataBytes += current.Header.HeaderSize;

// TODO when pruned node is implemented it should be header only for pruned blocks
current.BlockDataAvailability = BlockDataAvailabilityState.BlockAvailable;
Expand All @@ -263,7 +256,6 @@ public void Initialize(ChainedHeader consensusTip)

// Add the genesis block.
this.chainedHeadersByHash.Add(current.HashBlock, current);
this.ChainedBlocksDataBytes += current.Header.HeaderSize;

if (current.HashBlock != this.network.GenesisHash)
{
Expand Down Expand Up @@ -607,7 +599,6 @@ private void DisconnectChainHeader(ChainedHeader header)
{
header.Previous.Next.Remove(header);
this.chainedHeadersByHash.Remove(header.HashBlock);
this.ChainedBlocksDataBytes -= header.Header.HeaderSize;

if (header.Block != null)
{
Expand Down Expand Up @@ -1106,7 +1097,6 @@ private ChainedHeader CreateAndValidateNewChainedHeader(BlockHeader currentBlock

previousChainedHeader.Next.Add(newChainedHeader);
this.chainedHeadersByHash.Add(newChainedHeader.HashBlock, newChainedHeader);
this.ChainedBlocksDataBytes += newChainedHeader.Header.HeaderSize;

return newChainedHeader;
}
Expand Down
2 changes: 0 additions & 2 deletions src/Blockcore/Consensus/ConsensusManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,6 @@ private void AddComponentStats(StringBuilder log)
log.AppendLine($"Tip Age: { TimeSpan.FromSeconds(tipAge).ToString(@"dd\.hh\:mm\:ss") } (maximum is { TimeSpan.FromSeconds(maxTipAge).ToString(@"dd\.hh\:mm\:ss") })");
log.AppendLine($"In IBD Stage: { (this.isIbd ? "Yes" : "No") }");

log.AppendLine($"Chained header tree size: {this.chainedHeaderTree.ChainedBlocksDataBytes.BytesToMegaBytes()} MB");

string unconsumedBlocks = this.FormatBigNumber(this.chainedHeaderTree.UnconsumedBlocksCount);

double filledPercentage = Math.Round((this.chainedHeaderTree.UnconsumedBlocksDataBytes / (double)this.maxUnconsumedBlocksDataBytes) * 100, 2);
Expand Down