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

feat:dot/network: open block announce stream and send handshake on connect #1467

Merged
merged 9 commits into from
Mar 17, 2021

Conversation

noot
Copy link
Contributor

@noot noot commented Mar 15, 2021

Changes

  • open block announce stream and send handshake on connect

Tests

go test ./dot/network -run TestHandleConn

Issues

@codecov
Copy link

codecov bot commented Mar 16, 2021

Codecov Report

Merging #1467 (07c0614) into development (7859393) will increase coverage by 0.13%.
The diff coverage is 71.42%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #1467      +/-   ##
===============================================
+ Coverage        58.01%   58.15%   +0.13%     
===============================================
  Files              152      152              
  Lines            15307    15327      +20     
===============================================
+ Hits              8881     8914      +33     
+ Misses            4874     4862      -12     
+ Partials          1552     1551       -1     
Flag Coverage Δ
unit-tests 58.15% <71.42%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dot/network/service.go 62.02% <71.42%> (+2.22%) ⬆️
dot/network/utils.go 58.65% <0.00%> (-2.89%) ⬇️
lib/grandpa/grandpa.go 64.27% <0.00%> (-0.76%) ⬇️
lib/blocktree/blocktree.go 56.12% <0.00%> (+1.29%) ⬆️
dot/network/host.go 72.97% <0.00%> (+3.37%) ⬆️
dot/network/notifications.go 61.53% <0.00%> (+3.84%) ⬆️
lib/blocktree/leaves.go 95.12% <0.00%> (+4.87%) ⬆️
dot/network/block_announce.go 75.00% <0.00%> (+8.33%) ⬆️

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 7859393...07c0614. Read the comment docs.

s.notificationsMu.Lock()
defer s.notificationsMu.Unlock()

if _, has := s.notificationsProtocols[BlockAnnounceMsgType]; !has {
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid refetching BlockAnnounceMsgType from map.

info, has := s.notificationsProtocols[BlockAnnounceMsgType]
if !has {
   ....
}

peer := conn.RemotePeer()
if hsData, has := info.handshakeData[peer]; !has || !hsData.received {
info.handshakeData[peer] = &handshakeData{
validated: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we set also set received to true or reuse the hsData?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, at this point it hasn't sent or received any handshakes

@noot noot merged commit cd334a7 into development Mar 17, 2021
@noot noot deleted the noot/on-connect branch March 17, 2021 14:54
github-actions bot pushed a commit that referenced this pull request Mar 17, 2021
noot: feat:dot/network: open block announce stream and send handshake on connect (#1467)
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.

dot/network: open BlockAnnounce stream and send handshake on connect
5 participants