Skip to content
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
6 changes: 6 additions & 0 deletions fork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ def:
globs:
- "eth/downloader/downloader.go"
- "eth/downloader/receiptreference.go"
- title: PathDB diff-layers limit
description: |
Prevent the write-buffer to grow too large, to keep the journal optional,
and not restart on top of unavailable state.
globs:
- "triedb/pathdb/buffer.go"
- title: Discv5 node discovery
description: Fix discv5 option to allow discv5 to be an active source for node-discovery.
globs:
Expand Down
5 changes: 4 additions & 1 deletion triedb/pathdb/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ func (b *buffer) empty() bool {
// full returns an indicator if the size of accumulated content exceeds the
// configured threshold.
func (b *buffer) full() bool {
return b.size() > b.limit
// Limit not just by data size, but also the number of layers:
// if we allow the write-buffer to become larger,
// the journal becomes critical to not roll back to an unavailable state.
return b.size() > b.limit || b.layers >= uint64(maxDiffLayers)
}

// size returns the approximate memory size of the held content.
Expand Down