From d4dece7f860df933ae9c25f5b1ac696d1aa31a6f Mon Sep 17 00:00:00 2001 From: Kyrin Date: Thu, 16 Oct 2025 15:04:23 +0800 Subject: [PATCH] Fix writer restoration in journal loading Restore original writer after loading transactions from journal. --- core/txpool/locals/journal.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/txpool/locals/journal.go b/core/txpool/locals/journal.go index 46fd6de346..ed8b053fa8 100644 --- a/core/txpool/locals/journal.go +++ b/core/txpool/locals/journal.go @@ -58,6 +58,8 @@ func newTxJournal(path string) *journal { // load parses a transaction journal dump from disk, loading its contents into // the specified pool. func (journal *journal) load(add func([]*types.Transaction) []error) error { + originalWriter := journal.writer + // Open the journal for loading any past transactions input, err := os.Open(journal.path) if errors.Is(err, fs.ErrNotExist) { @@ -71,7 +73,7 @@ func (journal *journal) load(add func([]*types.Transaction) []error) error { // Temporarily discard any journal additions (don't double add on load) journal.writer = new(devNull) - defer func() { journal.writer = nil }() + defer func() { journal.writer = originalWriter }() // Inject all transactions from the journal into the pool stream := rlp.NewStream(input, 0)