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

Propagate signature verification and peer kinds to behaviour #46

Merged
merged 12 commits into from
Aug 12, 2020
Merged
8 changes: 6 additions & 2 deletions examples/gossipsub-chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
use async_std::{io, task};
use env_logger::{Builder, Env};
use futures::prelude::*;
use libp2p::gossipsub::protocol::MessageId;
use libp2p::gossipsub::MessageId;
use libp2p::gossipsub::{
GossipsubEvent, GossipsubMessage, IdentTopic as Topic, MessageAuthenticity,
};
Expand Down Expand Up @@ -142,7 +142,11 @@ fn main() -> Result<(), Box<dyn Error>> {
loop {
match swarm.poll_next_unpin(cx) {
Poll::Ready(Some(gossip_event)) => match gossip_event {
GossipsubEvent::Message(peer_id, id, message) => println!(
GossipsubEvent::Message{
propagation_source: peer_id,
message_id: id,
message
} => println!(
"Got message: {} with id: {} from peer: {:?}",
String::from_utf8_lossy(&message.data),
id,
Expand Down
6 changes: 5 additions & 1 deletion examples/ipfs-private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ fn main() -> Result<(), Box<dyn Error>> {
// Called when `gossipsub` produces an event.
fn inject_event(&mut self, event: GossipsubEvent) {
match event {
GossipsubEvent::Message(peer_id, id, message) => println!(
GossipsubEvent::Message {
propagation_source: peer_id,
message_id: id,
message
} => println!(
"Got message: {} with id: {} from peer: {:?}",
String::from_utf8_lossy(&message.data),
id,
Expand Down
Loading