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

Feature/Dont download existing block #7665

Merged
merged 20 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix test
  • Loading branch information
asdacap committed Oct 26, 2024
commit 4d11ef58c38e930407ecd2acd8a67b32771461e5
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Test_CanInsert()
}

[Test]
public void Test_LimitInsertedBlock()
public void Test_LimitStoredBlock()
{
BadBlockStore badBlockStore = new BadBlockStore(new TestMemDb(), 2);

Expand Down
2 changes: 0 additions & 2 deletions src/Nethermind/Nethermind.Blockchain/Blocks/BadBlockStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public void Insert(Block block, WriteFlags writeFlags = WriteFlags.None)
throw new InvalidOperationException("An attempt to store a block with a null hash.");
}

// if we carry Rlp from the network message all the way here we could avoid encoding back to RLP here
// Although cpu is the main bottleneck since NettyRlpStream uses pooled memory which avoid unnecessary allocations..
using NettyRlpStream newRlp = _blockDecoder.EncodeToNewNettyStream(block);
blockDb.Set(block.Number, block.Hash, newRlp.AsSpan(), writeFlags);

Expand Down
8 changes: 8 additions & 0 deletions src/Nethermind/Nethermind.Db/MemDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,13 @@ public virtual void Set(ReadOnlySpan<byte> key, byte[]? value, WriteFlags flags
}
_db[key] = value;
}

public IDbMeta.DbMetric GatherMetric(bool includeSharedCache = false)
{
return new IDbMeta.DbMetric()
{
Size = Count
};
}
}
}
Loading