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.
This commit is contained in:
Weixie Cui 2026-07-04 23:58:30 +08:00
parent e3b6d0c86f
commit a87a74f645

View file

@ -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)