NethermindEth / juno

Starknet client implementation.
https://juno.nethermind.io
Apache License 2.0
404 stars 170 forks source link

Refactor persistPeers function #2155

Closed AnkushinDaniil closed 2 months ago

AnkushinDaniil commented 2 months ago

As @derrix060 mentioned, we need to avoid iterating peers twice.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.37%. Comparing base (6735ed5) to head (622f365). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2155 +/- ## ======================================= Coverage 78.37% 78.37% ======================================= Files 100 100 Lines 9221 9221 ======================================= Hits 7227 7227 Misses 1355 1355 Partials 639 639 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

weiihann commented 2 months ago

While you're at it, there's a similar code pattern in the p2p/sync.go. That can be refactored too. https://github.com/NethermindEth/juno/blob/main/p2p/sync.go#L632-L649