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 the canonical chain is deleted #675

Merged
merged 3 commits into from
Nov 14, 2019

Conversation

earlbread
Copy link
Contributor

This fixed a bug where the canonical chain would be deleted if block download failed.

@earlbread earlbread added the bug Something isn't working label Nov 14, 2019
@earlbread earlbread self-assigned this Nov 14, 2019
@codecov
Copy link

codecov bot commented Nov 14, 2019

Codecov Report

Merging #675 into master will increase coverage by 0.01%.
The diff coverage is 96.55%.

@@            Coverage Diff             @@
##           master     #675      +/-   ##
==========================================
+ Coverage   87.33%   87.34%   +0.01%     
==========================================
  Files         218      218              
  Lines       17760    17781      +21     
==========================================
+ Hits        15510    15531      +21     
- Misses       1187     1192       +5     
+ Partials     1063     1058       -5
Impacted Files Coverage Δ
Libplanet.Tests/Net/SwarmTest.cs 98.86% <100%> (+0.01%) ⬆️
Libplanet/Net/Swarm.cs 86.29% <83.33%> (+0.35%) ⬆️
Libplanet/Store/DefaultStore.cs 82.64% <0%> (-1.24%) ⬇️

longfin
longfin previously approved these changes Nov 14, 2019
await BootstrapAsync(swarmA, swarmB.AsPeer);

swarmA.BroadcastBlocks(new[] { block });
await Task.Delay(100);
Copy link
Contributor

Choose a reason for hiding this comment

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

This scenario seems likely to make the test flaky, because swarmA.BroadcastBlocks(new[] { block }) could be faster than we assume… how about watching chainB.TipChanged event instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, we can't use the TipChanged event because block downloading should be failed before block appending is complete.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we make a new event to test this then?

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 added Swarm<T>. FillBlocksAsyncFailed for this test case.

Libplanet/Net/Swarm.cs Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
limebell
limebell previously approved these changes Nov 14, 2019
Copy link
Member

@limebell limebell left a comment

Choose a reason for hiding this comment

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

LGTM

dahlia
dahlia previously approved these changes Nov 14, 2019
longfin
longfin previously approved these changes Nov 14, 2019
limebell
limebell previously approved these changes Nov 14, 2019
earlbread and others added 2 commits November 14, 2019 16:14
Co-Authored-By: Hong Minhee <hong.minhee@gmail.com>
@earlbread earlbread merged commit ba6e84d into planetarium:master Nov 14, 2019
@earlbread earlbread deleted the fix-chain-delete branch November 18, 2019 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants