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

refactor get_ser() to use get_with() internally #3451

Merged
merged 1 commit into from
Sep 25, 2020

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Sep 25, 2020

This PR refactors some of the lmdb batch internals.

  • get_with() deserialization function now fallible
  • get_ser() uses get_with() internally and passes in default deserialization strategy
  • removed the awkward get_ser_access()
  • batch.exists() now aware of current write tx and not simply a wrapper to db.exists()

Related #3450 (which prompted this refactor).

We use get_ser() heavily as this uses the default deserialization strategy. But we also occasionally want more flexible access (see #3450). This PR consolidates get_with() and get_ser().

less code duplication and a cleaner code path
batch.exists() now aware of current write tx
@antiochp
Copy link
Member Author

Going to merge this. It's a refactor, no change to behavior. Tested locally and against mainnet.
The changes to exists() are limited as this is only called in a single location during block processing.

@antiochp antiochp merged commit 6278399 into mimblewimble:master Sep 25, 2020
@antiochp antiochp deleted the get_with_rework branch September 25, 2020 11:47
@antiochp antiochp mentioned this pull request Nov 26, 2020
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.

1 participant