From a87a74f6450b22cf2fc2f4008d50d5809b9e31e5 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sat, 4 Jul 2026 23:58:30 +0800 Subject: [PATCH] core/txpool/locals: nil journal writer before checking close error Clear journal.writer immediately after Close() so a failed close does not leave a stale file handle that could be reused on retry. --- core/txpool/locals/journal.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/txpool/locals/journal.go b/core/txpool/locals/journal.go index cd2be8a794..8db0fe94a0 100644 --- a/core/txpool/locals/journal.go +++ b/core/txpool/locals/journal.go @@ -152,10 +152,11 @@ func (journal *journal) insert(tx *types.Transaction) error { func (journal *journal) rotate(all map[common.Address]types.Transactions) error { // Close the current journal (if any is open) if journal.writer != nil { - if err := journal.writer.Close(); err != nil { + err := journal.writer.Close() + journal.writer = nil + if err != nil { return err } - journal.writer = nil } // Generate a new journal with the contents of the current pool replacement, err := os.OpenFile(journal.path+".new", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)