Skip to content

p2p: get rid of interface{} from PeerStore methods#6101

Merged
algorandskiy merged 1 commit intoalgorand:masterfrom
algorandskiy:pavel/p2p-ps-if
Aug 15, 2024
Merged

p2p: get rid of interface{} from PeerStore methods#6101
algorandskiy merged 1 commit intoalgorand:masterfrom
algorandskiy:pavel/p2p-ps-if

Conversation

@algorandskiy
Copy link
Copy Markdown
Contributor

Summary

At some point PeerStore was though to implement Phonebook interface, and as part of this some methods had interface{} in signature to accommodate both string and peer.AddrInfo. It ended up exact interface match not needed so I'm reverting this interface{} workaround.

Actually it is possible to keep addr []string in AddPersistentPeers and ReplacePeerList since they operate on single-address AddrInfo so string to AddrInfo conversion is possible.
In the same time GetAddresses returns slice of either strings (Phonebook) or generic learned peer.AddrInfo from the underlying peerstore, and no multiple addr to string conversion possible.

Test Plan

Existing tests to pass

@algorandskiy algorandskiy added Enhancement p2p Work related to the p2p project labels Aug 12, 2024
@algorandskiy algorandskiy self-assigned this Aug 12, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 81.48148% with 5 lines in your changes missing coverage. Please review.

Project coverage is 56.28%. Comparing base (23a04c2) to head (ae7fc9e).
Report is 3 commits behind head on master.

Files Patch % Lines
network/p2p/p2p.go 0.00% 3 Missing ⚠️
network/p2pNetwork.go 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6101      +/-   ##
==========================================
+ Coverage   56.25%   56.28%   +0.03%     
==========================================
  Files         490      490              
  Lines       69699    69698       -1     
==========================================
+ Hits        39206    39230      +24     
+ Misses      27825    27802      -23     
+ Partials     2668     2666       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@algorandskiy algorandskiy merged commit 3b9f3e3 into algorand:master Aug 15, 2024
@algorandskiy algorandskiy deleted the pavel/p2p-ps-if branch March 16, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement p2p Work related to the p2p project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants