Commit 4e65ceb9 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

l2geth: Dedupe dumper addresses in memory (#3852)

Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 05d367e5
---
'@eth-optimism/l2geth': patch
---
Dedupe dumper addresses in memory
......@@ -28,18 +28,25 @@ func NewStateDumper() StateDumper {
}
return &FileStateDumper{
f: f,
f: f,
ethCache: make(map[common.Address]bool),
}
}
type FileStateDumper struct {
f io.Writer
mtx sync.Mutex
f io.Writer
ethCache map[common.Address]bool
mtx sync.Mutex
}
func (s *FileStateDumper) WriteETH(address common.Address) {
s.mtx.Lock()
defer s.mtx.Unlock()
if s.ethCache[address] {
return
}
s.ethCache[address] = true
if _, err := s.f.Write([]byte(fmt.Sprintf("ETH|%s\n", address.Hex()))); err != nil {
panic(err)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment