-
Notifications
You must be signed in to change notification settings - Fork 218
P2p gossip propagate once #809
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
Conversation
p2p/gossip/protocol.go
Outdated
relayQ: relayChan, | ||
messageQ: make(chan protocolMessage, messageQBufferSize), | ||
propagateQ: make(chan service.MessageValidation, propagateHandleBufferSize), | ||
//invalidMessageQ: make(map[hash]bool), // todo : remember to drain this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to remove
p2p/gossip/protocol.go
Outdated
}() | ||
return nil | ||
} | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed
p2p/gossip/protocol.go
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an Error, not info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I know it's my code :))
p2p/gossip/protocol.go
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also should be an error
p2p/gossip/protocol.go
Outdated
for p := range prot.peers { | ||
peer := prot.peers[p] | ||
peer.send(data, h) // non blocking | ||
for e := range exclude { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case do you expect seeing more than one sender?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the only call to this method passes one sender
p2p/gossip/protocol.go
Outdated
msg := &pb.ProtocolMessage{ | ||
Metadata: header, | ||
Payload: &pb.Payload{Data: &pb.Payload_Payload{payload}}, | ||
} | ||
|
||
prot.processMessage(msg) | ||
prot.processMessage(prot.localNodePubkey, msg) // todo: pass sender |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add log print
945641d
to
985e669
Compare
…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.)
42eccb2
to
0e5da13
Compare
No description provided.