Skip to content

p2p: tighten up and test PeerManager#6034

Merged
mergify[bot] merged 46 commits intomasterfrom
erik/peermanager-tests
Feb 3, 2021
Merged

p2p: tighten up and test PeerManager#6034
mergify[bot] merged 46 commits intomasterfrom
erik/peermanager-tests

Conversation

@erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Feb 2, 2021

This tightens up the PeerManager and related code, adds a ton of tests, and fixes a bunch of inconsistencies and bugs.

@erikgrinaker erikgrinaker added C:p2p Component: P2P pkg T:test Type: Tests that need love S:automerge Automatically merge PR when requirements pass labels Feb 2, 2021
@erikgrinaker erikgrinaker self-assigned this Feb 2, 2021
@codecov
Copy link

codecov bot commented Feb 2, 2021

Codecov Report

Merging #6034 (71b2a29) into master (5f88d6a) will increase coverage by 0.70%.
The diff coverage is 79.44%.

@@            Coverage Diff             @@
##           master    #6034      +/-   ##
==========================================
+ Coverage   59.85%   60.55%   +0.70%     
==========================================
  Files         274      276       +2     
  Lines       25248    25314      +66     
==========================================
+ Hits        15112    15329     +217     
+ Misses       8520     8370     -150     
+ Partials     1616     1615       -1     
Impacted Files Coverage Δ
p2p/address.go 97.82% <ø> (-0.03%) ⬇️
p2p/channel.go 100.00% <ø> (ø)
p2p/peer.go 50.41% <ø> (+2.87%) ⬆️
p2p/pex/reactor.go 0.00% <0.00%> (ø)
p2p/router.go 60.45% <21.42%> (+1.57%) ⬆️
blockchain/v0/reactor.go 63.20% <35.71%> (+0.99%) ⬆️
p2p/shim.go 51.90% <40.00%> (ø)
statesync/reactor.go 57.01% <44.44%> (-0.38%) ⬇️
evidence/reactor.go 72.80% <75.00%> (+0.63%) ⬆️
mempool/reactor.go 65.71% <80.00%> (-0.96%) ⬇️
... and 18 more

m.mtx.Lock()
defer m.mtx.Unlock()

peer, _ := m.store.Get(peerID)
Copy link
Contributor

Choose a reason for hiding this comment

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

what if there's no peer with such peerID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will return the zero value, i.e. 0, as described in the comment.

@mergify mergify bot merged commit 2aad26e into master Feb 3, 2021
@mergify mergify bot deleted the erik/peermanager-tests branch February 3, 2021 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C:p2p Component: P2P pkg S:automerge Automatically merge PR when requirements pass T:test Type: Tests that need love

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants