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

P2p gossip propagate once #809

Merged
merged 5 commits into from Apr 15, 2019

Conversation

Projects
None yet
2 participants
@y0sher
Copy link
Collaborator

commented Apr 12, 2019

No description provided.

relayQ: relayChan,
messageQ: make(chan protocolMessage, messageQBufferSize),
propagateQ: make(chan service.MessageValidation, propagateHandleBufferSize),
//invalidMessageQ: make(map[hash]bool), // todo : remember to drain this

This comment has been minimized.

Copy link
@y0sher

y0sher Apr 14, 2019

Author Collaborator

to remove

}()
return nil
}
return

This comment has been minimized.

Copy link
@y0sher

y0sher Apr 14, 2019

Author Collaborator

not needed

p.Debug("sending message to peer %v, hash %d", p.pubkey, checksum)
err := p.net.SendMessage(p.pubkey, ProtocolName, msg)
if err != nil {
p.Log.Info("Gossip protocol failed to send msg (calcHash %d) to peer %v, first attempt. err=%v", checksum, p.pubkey, err)

This comment has been minimized.

Copy link
@zalmen

zalmen Apr 15, 2019

Member

This should be an Error, not info.

This comment has been minimized.

Copy link
@zalmen

zalmen Apr 15, 2019

Member

(I know it's my code :))

p.Log.Info("Gossip protocol failed to send msg (calcHash %d) to peer %v, second attempt. err=%v", checksum, p.pubkey, err)
return
}
p.Log.Info("Gossip protocol failed to send msg (calcHash %d) to peer %v, second attempt. err=%v", checksum, p.pubkey, err)

This comment has been minimized.

Copy link
@zalmen

zalmen Apr 15, 2019

Member

also should be an error

for p := range prot.peers {
peer := prot.peers[p]
peer.send(data, h) // non blocking
for e := range exclude {

This comment has been minimized.

Copy link
@zalmen

zalmen Apr 15, 2019

Member

In which case do you expect seeing more than one sender?

This comment has been minimized.

Copy link
@zalmen

zalmen Apr 15, 2019

Member

Currently, the only call to this method passes one sender

msg := &pb.ProtocolMessage{
Metadata: header,
Payload: &pb.Payload{Data: &pb.Payload_Payload{payload}},
}

prot.processMessage(msg)
prot.processMessage(prot.localNodePubkey, msg) // todo: pass sender

This comment has been minimized.

Copy link
@zalmen

zalmen Apr 15, 2019

Member

Why the "todo"?

// message and will determine its validity, therefore we can return in such case as well
return
}
// todo : - maybe block this peer since he sends us old messages

This comment has been minimized.

Copy link
@zalmen

zalmen Apr 15, 2019

Member

add log print

@y0sher y0sher force-pushed the p2p_gossip_propagateonce branch from 945641d to 985e669 Apr 15, 2019

y0sher added some commits Apr 12, 2019

- remove per-peer cache, only don't propagate to origin neighbor. (mi…
…ght need to pass it to protocols and back to gossip in validation phase).

- do not propagate old messages. (ever)
- remove global invalid cache, since we'll never propagate twice even if valids
- maybe remove gossip "invalid" reporting since we'll only propagate valid and won't save old. (we can keep it for future use.)

@y0sher y0sher force-pushed the p2p_gossip_propagateonce branch from 42eccb2 to 0e5da13 Apr 15, 2019

@zalmen

zalmen approved these changes Apr 15, 2019

@y0sher y0sher merged commit 0bbbd71 into develop Apr 15, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.