-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(net): fix failure to process FETCH_INV_DATA message #5460
Conversation
synchronized (this) { | ||
if (invToFetch.isEmpty() || peers.isEmpty()) { | ||
return; | ||
} | ||
long now = System.currentTimeMillis(); | ||
invToFetch.forEach((item, time) -> { | ||
if (time < now - MSG_CACHE_DURATION_IN_BLOCKS * BLOCK_PRODUCED_INTERVAL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't MSG_CACHE_DURATION_IN_BLOCKS * BLOCK_PRODUCED_INTERVAL
be replaced with TIMEOUT
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more. @@ Coverage Diff @@
## develop #5460 +/- ##
==========================================
Coverage 61.45% 61.45%
+ Complexity 9370 9369 -1
==========================================
Files 846 846
Lines 50298 50300 +2
Branches 5585 5585
==========================================
+ Hits 30911 30913 +2
+ Misses 16969 16968 -1
- Partials 2418 2419 +1
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
invToFetch.remove(item); | ||
}); | ||
peers.stream().filter(peer -> { | ||
Long t = peer.getAdvInvReceive().getIfPresent(item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the same, times from different caches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
math.abs(t-time)
is very close to 0. Am I getting this right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
math.abs(t-time) is very close to 0
if time >= now - TIMEOUT, now - t < TIMEOUT
when is it false?
invToFetch.forEach((item, time) -> { | ||
if (time < now - MSG_CACHE_DURATION_IN_BLOCKS * BLOCK_PRODUCED_INTERVAL) { | ||
if (time < now - TIMEOUT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an assumption: no more than 2w transactions will be broadcast within 15s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At present, it is basically impossible to reach 20,000 within 15 seconds. We only focus on time and not TPS.
What does this PR do?
Fix failure to process FETCH_INV_DATA message, fix #5439.
Why are these changes required?
This PR has been tested by:
Follow up
Extra details