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

move block sync request limit #3231

Merged
merged 1 commit into from Mar 31, 2022
Merged

move block sync request limit #3231

merged 1 commit into from Mar 31, 2022

Conversation

CoderZhi
Copy link
Collaborator

@CoderZhi CoderZhi commented Mar 24, 2022

Description

Move block sync request limit position from consumer side to producer size to prevent flooding request from one neighbor.

Fixes #3228

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

make minicluster

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@CoderZhi CoderZhi requested a review from a team as a code owner March 24, 2022 21:47
@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #3231 (a36d874) into master (ae66d8b) will decrease coverage by 0.00%.
The diff coverage is 71.42%.

❗ Current head a36d874 differs from pull request most recent head 687b779. Consider uploading reports for the commit 687b779 to get more accurate results

@@            Coverage Diff             @@
##           master    #3231      +/-   ##
==========================================
- Coverage   74.96%   74.95%   -0.01%     
==========================================
  Files         228      228              
  Lines       21355    21353       -2     
==========================================
- Hits        16008    16006       -2     
- Misses       4477     4478       +1     
+ Partials      870      869       -1     
Impacted Files Coverage Δ
dispatcher/dispatcher.go 71.42% <71.42%> (-0.26%) ⬇️
consensus/scheme/rolldpos/rolldposctx.go 73.59% <0.00%> (-0.49%) ⬇️
db/trie/mptrie/branchnode.go 98.61% <0.00%> (+1.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae66d8b...687b779. Read the comment docs.

d.syncChanLock.Lock()
defer d.syncChanLock.Unlock()
last, ok := d.peerLastSync[peerID]
Copy link
Member

Choose a reason for hiding this comment

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

I think reserving the subfunc is more readable.

if !d.checkSyncPermission(peer.ID.Pretty()) {
return
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

do you consider this style issue as a blocker of this PR?

Copy link
Member

Choose a reason for hiding this comment

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

no

@CoderZhi CoderZhi merged commit ca93cb4 into master Mar 31, 2022
@CoderZhi CoderZhi deleted the reject_block_sync_request branch March 31, 2022 19:06
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.

Filter block sync request before adding it to channel
3 participants