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

Don't disconnect masternode connections when we have less then the desired amount of outbound nodes #3255

Merged
merged 1 commit into from
Jan 1, 2020

Conversation

codablock
Copy link

This avoids situations where we end up disconnecting (nearly) all outgoing peers when masternode connection cleanup is happening.

This also indirectly fixes test failures like this, where cleanup happened directly after a block was requested via getdata.

The real reason for this test failure is actually a different one, but I was not able to pin it down. What happens is that node4 gets a header announced from peer=1. Node4 then reacts with a getdata to retrieve the block. Shortly after that, peer=1 is disconnected due to the masternode connection cleanup. Approximately at the same time node4 receives a cmpctblock from peer=0, which is however ignored due to this code (FillBlock fails). It gets into this code because FinalizeNode was not called at this point, so that the block is considered as in-flight.

I would expect that even after peer=1 is disconnect, FindNextBlocksToDownload would realize that the block in not in-flight anymore and needs to be re-requested from another node. But for some reason this is not happening. I was not able to reproduce this locally. As I'm unable to fix the actual bug, I decided to implement a fix that avoids the disconnect in this situation. This fix is also useful on its own as I believe.

@codablock codablock added this to the 16 milestone Dec 30, 2019
@UdjinM6 UdjinM6 modified the milestones: 16, 15 Dec 31, 2019
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

👍

utACK

@UdjinM6 UdjinM6 merged commit a8e7133 into dashpay:develop Jan 1, 2020
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Jan 10, 2020
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
FornaxA pushed a commit to ioncoincore/ion that referenced this pull request Jul 6, 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.

2 participants