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

Use lmdb store for swap requests #16

Merged
merged 5 commits into from
Sep 16, 2022
Merged

Use lmdb store for swap requests #16

merged 5 commits into from
Sep 16, 2022

Conversation

scilio
Copy link
Collaborator

@scilio scilio commented Aug 25, 2022

Rather than use an in-memory cache for swap requests waiting to be processed, we switch to using an lmdb database to avoid data loss in the event of a process interruption.

Fixes #5

scilio added 4 commits August 25, 2022 17:27
(cherry picked from commit f1f23c4295097e0f806098647dcc2a4d31715355)
(cherry picked from commit 7ab6d3086e4c946ef117ed244bd33c87ff5b9142)
@scilio scilio marked this pull request as ready for review September 14, 2022 16:57
pub enum SwapStatus {
Unprocessed,
InProcess { kernel_hash: Hash },
Completed { kernel_hash: Hash, block_hash: Hash },
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't use the Completed status yet, nor do we delete SwapData entries after they've long been confirmed. That will be added as part of #8

Copy link
Member

@phyro phyro left a comment

Choose a reason for hiding this comment

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

I didn't run the code. I plan to do that towards the end of the milestone when the thing is complete to avoid too much manual testing in between. I did go through the code and this looks good to me 👍

#[derive(Clone, Debug, PartialEq)]
pub enum SwapStatus {
Unprocessed,
InProcess { kernel_hash: Hash },
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: At first I wrongly assumed the InProcess was during the round communication when it's really after it's been sent to the mempool and before being sealed on the chain. Might make sense to add a comment explaining these.

@phyro phyro merged commit dae4f87 into mimblewimble:main Sep 16, 2022
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.

Recover swap requests after process interruption
2 participants