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

(3/8) [REFACTOR] P2PDataStore::add/remove/refresh #3557

Merged

Conversation

julianknutsen
Copy link
Contributor

Improve clarity and add comments for future readers to help them reason about the behavior.

This also paves the way for deduplicating the remove() paths and helps identify the shared code paths
that can be merged in future refactoring work.

@julianknutsen julianknutsen changed the title (3/4) [REFACTOR] P2PDataStore::add/remove/refresh (3/8) [REFACTOR] P2PDataStore::add/remove/refresh Nov 9, 2019
Fix a bug where remove() was called in the addMailboxData()
failure path.

1. Sender's can't remove mailbox entries. Only
   the receiver can remove it so even if the previous add() failed and
   left partial state, the remove() can never succeed.

2. Even if the sender could remove, this path used remove() instead
   of removeMailboxData() so it wouldn't have succeed anyway.

This patch cleans up the failure path as well as adds a precondition
for the remove() function to ensure future callers don't use them for
ProtectedMailboxStorageEntrys.
Add comments and refactor the body in order to make it easier to
understand.
Refactor addProtectedStorageEntry for more readability and add comments
to help future readers.
Refactor for readability and add comments for future readers.
Refactor for readability and add comments to help future readers.
Refactor for readability and add comments for future readers.
Removed duplicate log messages that are handled inside the various helper methods
and print more verbose state useful for debugging.

Updated potentially misleading comments around hashing collisions
@julianknutsen
Copy link
Contributor Author

julianknutsen commented Nov 11, 2019

Commits start at: 5512f34

This got stale and polluted with merge commits. Updated against master and all previous comments have been addressed.

Copy link
Member

@freimair freimair left a comment

Choose a reason for hiding this comment

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

utAck

Copy link
Member

@ripcurlx ripcurlx left a comment

Choose a reason for hiding this comment

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

utACK - 👍 makes it way easier to read than before.

@ripcurlx ripcurlx merged commit d484617 into bisq-network:master Nov 18, 2019
@julianknutsen julianknutsen deleted the refactor-add-remove-refresh branch November 18, 2019 18:11
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.

None yet

4 participants