Skip to content

Conversation

@KyrinCode
Copy link
Contributor

@KyrinCode KyrinCode commented Oct 16, 2025

Previously, the journal writer is nil until the first time rejournal (default 1h), which means during this period, txs submitted to this node are not written into journal file (transactions.rlp). If this node is shutdown before the first time rejournal, then txs in pending or queue will get lost.

Here, this PR initializes the journal writer soon after launch to solve this issue.

…he first time rejournal.

Previously, the journal writer is nil until the first time rejournal (default 1h), which means during this period, txs submitted to this node are not written into journal file.
@KyrinCode KyrinCode changed the title Initialize journal writer soon after loading instead of waiting for the first time rejournal. core/txpool: Initialize journal writer soon after loading instead of waiting for the first time rejournal. Oct 16, 2025
@KyrinCode KyrinCode changed the title core/txpool: Initialize journal writer soon after loading instead of waiting for the first time rejournal. core/txpool: Initialize journal writer soon after launch instead of waiting for the first time rejournal. Oct 16, 2025
Refactor journal load method to use nil writer instead of original writer. Add setWriter method to handle journal file opening for writing new transactions.
rjl493456442
rjl493456442 previously approved these changes Oct 21, 2025
@rjl493456442 rjl493456442 changed the title core/txpool: Initialize journal writer soon after launch instead of waiting for the first time rejournal. core/txpool: Initialize journal writer for tx tracker Oct 21, 2025
@rjl493456442 rjl493456442 added this to the 1.16.6 milestone Oct 21, 2025
Copy link
Contributor Author

@KyrinCode KyrinCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to consider the case when journal path is empty and journal is nil. Then recheck method will run into nil error at tracker.journal.rotate().

@rjl493456442
Copy link
Member

Thanks for catching it! I think it should be ready to go.

@rjl493456442 rjl493456442 merged commit d73bfeb into ethereum:master Oct 21, 2025
5 of 6 checks passed
rjl493456442 added a commit to rjl493456442/go-ethereum that referenced this pull request Oct 28, 2025
Previously, the journal writer is nil until the first time rejournal
(default 1h), which means during this period, txs submitted to this node
are not written into journal file (transactions.rlp). If this node is
shutdown before the first time rejournal, then txs in pending or queue
will get lost.

Here, this PR initializes the journal writer soon after launch to solve
this issue.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants