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

Fix hanging block download #1574

Merged

Conversation

Projects
None yet
3 participants
@NicolasDorier
Copy link
Contributor

commented Jun 17, 2019

BTCPayServer users run a pruned node, which mean that without this pull request, the block download would hang 64 seconds before connecting to another peer.

This PR disconnects immediately if the remote node does not have the block.

NBitcoin GetBlocks method has been developed to download the most blocks simultaneously, it is overkill if you only want one block.

@NicolasDorier NicolasDorier force-pushed the NicolasDorier:feature/hanging-block-download branch 2 times, most recently from b850c36 to 2914aff Jun 17, 2019

@NicolasDorier NicolasDorier force-pushed the NicolasDorier:feature/hanging-block-download branch from 2914aff to 53f48fc Jun 17, 2019

nopara73 added some commits Jun 17, 2019

@nopara73 nopara73 merged commit cdf9fca into zkSNACKs:master Jun 17, 2019

3 of 4 checks passed

Wasabi.Windows in progress
Details
CodeFactor No issues found.
Details
Wasabi.Linux #20190617.7 succeeded
Details
Wasabi.Osx #20190617.7 succeeded
Details
@lontivero

This comment has been minimized.

Copy link
Collaborator

commented Jun 17, 2019

For some reason this doesn't work for RegTest, pretty weird. I will take a look why.

@NicolasDorier

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2019

but the tests were passing?

@nopara73

This comment has been minimized.

Copy link
Collaborator

commented Jun 18, 2019

No. Only the unit tests run on CI. Integration tests are stuck.

@NicolasDorier

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2019

@nopara73 why integration tests do not run on CI?

@nopara73

This comment has been minimized.

Copy link
Collaborator

commented Jun 18, 2019

@nopara73 why integration tests do not run on CI?

There are two parts to it:

  • Tor is unreliable, so those that needs it are failing randomly.
  • The regtests are not written properly, they are too interconnected, so those are also sometimes failing randomly.
@NicolasDorier

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2019

@lontivero I tried locally on regtest and this worked well... which test is frozen?

@@ -791,16 +791,12 @@ public async Task<Block> GetOrDownloadBlockAsync(uint256 hash, CancellationToken

Block blockFromLocalNode = null;
// Should timeout faster. Not sure if it should ever fail though. Maybe let's keep like this later for remote node connection.
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(64))) // 1/2 ADSL 512 kbit/s 00:00:32

This comment has been minimized.

Copy link
@NicolasDorier

NicolasDorier Jun 18, 2019

Author Contributor

this is what make the test fail.

@NicolasDorier NicolasDorier deleted the NicolasDorier:feature/hanging-block-download branch Jun 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.