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

Improve getBlocks request handling #4851

Merged

Conversation

chimp1984
Copy link
Contributor

No description provided.

Copy link
Contributor

@ghubstan ghubstan left a comment

Choose a reason for hiding this comment

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

utACK

core/src/main/java/bisq/core/dao/node/lite/LiteNode.java Outdated Show resolved Hide resolved
core/src/main/java/bisq/core/dao/node/lite/LiteNode.java Outdated Show resolved Hide resolved
core/src/main/java/bisq/core/dao/node/lite/LiteNode.java Outdated Show resolved Hide resolved
core/src/main/java/bisq/core/dao/node/lite/LiteNode.java Outdated Show resolved Hide resolved
@@ -168,31 +167,36 @@ public void onFailure(@NotNull Throwable throwable) {
@Override
public void onMessage(NetworkEnvelope networkEnvelope, Connection connection) {
if (networkEnvelope instanceof GetBlocksResponse) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (networkEnvelope instanceof GetBlocksResponse) {
if (!(networkEnvelope instanceof GetBlocksResponse)) return; // Also need to remove other brace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer to not return early here as this style is commonly used in many places and often there are several if else branches. It is more like a dispatcher or switch case style (if switch would be more flexible in java). I prefer to use the early return for validation use cases but here its more to select the msg we are interested in.

Copy link
Member

Choose a reason for hiding this comment

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

That's a good point. Might be cleaner to make a handleGetBlocksResponse(GetBlocksResponse r) and other respective dispatch handlers like is done in the trade protocol for these cases.

@ripcurlx
Copy link
Contributor

ripcurlx commented Dec 9, 2020

@sqrrm Is there anything else you want @chimp1984 to address?

@sqrrm
Copy link
Member

sqrrm commented Dec 9, 2020

@ripcurlx I have nothing more but in private @chimp1984 mentioned he might want to add some more so I'll wait for that to merge.

@chimp1984
Copy link
Contributor Author

@ripcurlx I would like to do myself another review before merging it.

@chimp1984 chimp1984 changed the title Improve getBlocks request handling [WIP] Improve getBlocks request handling Dec 16, 2020
@chimp1984 chimp1984 force-pushed the improve-bsq-get-block-request-handling branch from cb9ddb1 to 357c980 Compare December 28, 2020 17:24
Add checks to tryWithNewSeedNode method
Cleanups
Cleanups
@chimp1984 chimp1984 changed the title [WIP] Improve getBlocks request handling Improve getBlocks request handling Dec 28, 2020
Copy link
Contributor

@ManfredKarrer ManfredKarrer 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

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

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

utACK

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.

5 participants