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

catchpoint: fix peer ranking #4535

Merged

Conversation

algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Sep 12, 2022

Summary

  • Similar to tests: fix TestBasicCatchpointCatchup #4390, if the local ledger has a block, do not rank peer.
  • In order to implement a unit test, had to abstract ledger.Ledger as an interface.
  • Fixed some typos in comments and variable names.

Test Plan

Added a new unit test.

@codecov
Copy link

codecov bot commented Sep 12, 2022

Codecov Report

Merging #4535 (661764e) into master (22b6101) will increase coverage by 0.04%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #4535      +/-   ##
==========================================
+ Coverage   54.06%   54.10%   +0.04%     
==========================================
  Files         401      401              
  Lines       51540    51547       +7     
==========================================
+ Hits        27863    27888      +25     
+ Misses      21346    21316      -30     
- Partials     2331     2343      +12     
Impacted Files Coverage Δ
catchup/catchpointService.go 7.80% <0.00%> (+6.03%) ⬆️
catchup/ledgerFetcher.go 40.22% <ø> (ø)
ledger/catchupaccessor.go 62.03% <0.00%> (-0.13%) ⬇️
node/node.go 4.40% <0.00%> (-0.03%) ⬇️
ledger/blockqueue.go 85.63% <0.00%> (-2.88%) ⬇️
ledger/acctupdates.go 69.59% <0.00%> (-0.60%) ⬇️
network/wsNetwork.go 64.63% <0.00%> (-0.20%) ⬇️
network/wsPeer.go 68.73% <0.00%> (+0.53%) ⬆️
catchup/service.go 69.38% <0.00%> (+0.74%) ⬆️
cmd/tealdbg/debugger.go 73.49% <0.00%> (+0.80%) ⬆️
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@algorandskiy algorandskiy requested review from a user, cce and algonautshant September 12, 2022 20:40
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Contributor

@algonautshant algonautshant left a comment

Choose a reason for hiding this comment

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

Looks great.
Just one more cleanup suggestion.

log: log,
newService: false,
net: net,
ledger: l,
ledger: accessor.Ledger(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are cleaning up this code, will be nice to also get rid of the ledger field in CatchpointCatchupService, and rely on ledgerAccessor.Ledger() instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants