Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore txpool after reboot #5509

Closed
jsvisa opened this issue Nov 21, 2023 · 4 comments · Fixed by #5665
Closed

Restore txpool after reboot #5509

jsvisa opened this issue Nov 21, 2023 · 4 comments · Fixed by #5665
Assignees
Labels
A-tx-pool Related to the transaction mempool C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started

Comments

@jsvisa
Copy link
Contributor

jsvisa commented Nov 21, 2023

Describe the feature

Reth will not dump the txpool's content into disk and restore them after reboot, this will cause the local txs to be missing if they were not announced before reboot.

Additional context

No response

@jsvisa jsvisa added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Nov 21, 2023
@mattsse mattsse added S-needs-design This issue requires design work to think about how it would best be accomplished A-tx-pool Related to the transaction mempool and removed S-needs-triage This issue needs to be labelled labels Nov 21, 2023
@mattsse
Copy link
Collaborator

mattsse commented Nov 21, 2023

right, we definitely want this

I guess we can get away with only dumping local txs?
or at least start with that

@jsvisa
Copy link
Contributor Author

jsvisa commented Nov 21, 2023

I guess we can get away with only dumping local txs?
or at least start with that

I totally agree with the only dump/restore the local txs

@mattsse
Copy link
Collaborator

mattsse commented Nov 30, 2023

Adding a bit more context

we can now perform cleanup tasks like:

reth/bin/reth/src/node/mod.rs

Lines 1036 to 1042 in 12d9559

async fn run_network_until_shutdown<C>(
shutdown: reth_tasks::shutdown::GracefulShutdown,
network: NetworkManager<C>,
persistent_peers_file: Option<PathBuf>,
) where
C: BlockReader + HeaderProvider + Clone + Unpin + 'static,
{

so what we want here is

a new task that awaits the shutdown, fetches all local transactions and writes them to a file
and before it awaits the shutdown it reads local transactions and simply inserts all of them.

this function should go here:

we want a specific location for the file, should be a constant like:

reth/bin/reth/src/dirs.rs

Lines 288 to 294 in 12d9559

/// Returns the path to the blobstore directory for this chain where blobs of unfinalized
/// transactions are stored.
///
/// `<DIR>/<CHAIN_ID>/blobstore`
pub fn blobstore_path(&self) -> PathBuf {
self.0.join("blobstore").into()
}

@mattsse mattsse added D-good-first-issue Nice and easy! A great choice to get started and removed S-needs-design This issue requires design work to think about how it would best be accomplished labels Nov 30, 2023
@allnil
Copy link
Contributor

allnil commented Nov 30, 2023

Take it

@mattsse mattsse linked a pull request Dec 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tx-pool Related to the transaction mempool C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants