go-ethereum/core/txpool/locals
rayoo 202e35e79a core/txpool/locals: fix data race on journal writer
The journal.setupWriter and journal.close calls in TxTracker.loop
are not protected by tracker.mu, while recheck and TrackAll access
journal.writer under the same mutex. This causes a data race
between the loop goroutine and callers of recheck/TrackAll.

Hold tracker.mu around setupWriter and close in loop to
synchronize access to journal.writer.

Fixes a race detected by go test -race:

  Write at journal.setupWriter (journal.go:134)
    by goroutine running TxTracker.loop

  Previous read at journal.rotate (journal.go:154)
    by goroutine running TxTracker.recheck
2026-04-20 15:44:51 +08:00
..
errors.go eth: add tx to locals only if it has a chance of acceptance (#31618) 2025-04-17 21:27:48 +02:00
journal.go core/txpool: Initialize journal writer for tx tracker (#32921) 2025-10-21 15:41:38 +08:00
tx_tracker.go core/txpool/locals: fix data race on journal writer 2026-04-20 15:44:51 +08:00
tx_tracker_test.go cmd, core, trie, triedb: split CachingDB into merkle + binary dbs. (#34700) 2026-04-17 08:55:54 +08:00