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

Bad tip expiration for pulling blocks fix #1614

Merged

Conversation

greymistcube
Copy link
Contributor

@greymistcube greymistcube commented Nov 25, 2021

Inequality inside Swarm<T>.PollBlocksAsync() determining whether tip has become stale was set up to act oppositely to what was intended. This would've resulted in not polling properly once tip has actually gone stale unless tip is changed by a push from another node.

Also, changed the polling interval to 60 seconds.

@greymistcube greymistcube marked this pull request as ready for review November 25, 2021 02:05
Copy link
Contributor

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

IMO it needs to target to a maintenance branch instead of the main branch.

Libplanet/Net/SwarmOptions.cs Show resolved Hide resolved
@@ -155,11 +155,11 @@ CancellationToken cancellationToken
lastUpdated = DateTimeOffset.UtcNow;
lastTip = BlockChain.Tip;
}
else if (lastUpdated + tipLifespan > DateTimeOffset.UtcNow)
else if (lastUpdated + tipLifespan < DateTimeOffset.UtcNow)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be difficult to add a regression test for this bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it's probably possible to do a unit test by elevating the access level to internal and directly calling the method, but I'm not sure about a regression test. 😗

@greymistcube greymistcube force-pushed the bugfix/tip-expiration branch 2 times, most recently from 6513a00 to 2800e02 Compare November 25, 2021 02:37
@greymistcube greymistcube changed the base branch from main to 0.21-maintenance November 25, 2021 03:03
@greymistcube greymistcube merged commit 4646fa6 into planetarium:0.21-maintenance Nov 25, 2021
dahlia added a commit to dahlia/libplanet that referenced this pull request Nov 25, 2021
@greymistcube greymistcube deleted the bugfix/tip-expiration branch December 13, 2021 06:14
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

2 participants