Skip to content

Commit

Permalink
fix: boot node connections
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-eiger committed Oct 4, 2023
1 parent c879099 commit 4608d4e
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 91 deletions.
115 changes: 69 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["graphprotocol", "gossip-network", "sdk", "waku", "p2p"]
categories = ["network-programming", "web-programming::http-client"]

[dependencies]
waku = { version = "=0.3.1", package = "waku-bindings" }
waku = { version = "=0.3.2", package = "waku-bindings" }
slack-morphism = { version = "1.10", features = ["hyper", "axum"] }
prost = "0.11"
once_cell = "1.17"
Expand Down
16 changes: 9 additions & 7 deletions examples/ping-pong/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ async fn main() {
// if not provided then they are usually generated based on indexer allocations
let subtopics: Vec<String> = vec!["ping-pong-content-topic".to_string()];

let discovery_enr = "enr:-P-4QJI8tS1WTdIQxq_yIrD05oIIW1Xg-tm_qfP0CHfJGnp9dfr6ttQJmHwTNxGEl4Le8Q7YHcmi-kXTtphxFysS11oBgmlkgnY0gmlwhLymh5GKbXVsdGlhZGRyc7hgAC02KG5vZGUtMDEuZG8tYW1zMy53YWt1djIucHJvZC5zdGF0dXNpbS5uZXQGdl8ALzYobm9kZS0wMS5kby1hbXMzLndha3V2Mi5wcm9kLnN0YXR1c2ltLm5ldAYfQN4DiXNlY3AyNTZrMaEDbl1X_zJIw3EAJGtmHMVn4Z2xhpSoUaP5ElsHKCv7hlWDdGNwgnZfg3VkcIIjKIV3YWt1Mg8".to_string();

// GraphcastAgentConfig defines the configuration that the SDK expects from all Radios, regardless of their specific functionality
let graphcast_agent_config = GraphcastAgentConfig::new(
config.private_key.expect("No private key provided"),
Expand All @@ -106,8 +108,7 @@ async fn main() {
None,
None,
Some(true),
// Example ENR address
Some(vec![String::from("enr:-JK4QBcfVXu2YDeSKdjF2xE5EDM5f5E_1Akpkv_yw_byn1adESxDXVLVjapjDvS_ujx6MgWDu9hqO_Az_CbKLJ8azbMBgmlkgnY0gmlwhAVOUWOJc2VjcDI1NmsxoQOUZIqKLk5xkiH0RAFaMGrziGeGxypJ03kOod1-7Pum3oN0Y3CCfJyDdWRwgiMohXdha3UyDQ")]),
Some(vec![discovery_enr]),
None,
)
.await
Expand Down Expand Up @@ -178,10 +179,7 @@ async fn main_loop(agent: &GraphcastAgent, running: Arc<AtomicBool>) {
info!(block = block_number, "🔗 Block number");
if block_number & 2 == 0 {
// If block number is even, send ping message
let msg = SimpleMessage::new(
"table".to_string(),
std::env::args().nth(1).unwrap_or("Ping".to_string()),
);
let msg = SimpleMessage::new("table".to_string(), "Ping".to_string());
if let Err(e) = agent
.send_message(
// The identifier can be any string that suits your Radio logic
Expand All @@ -193,6 +191,8 @@ async fn main_loop(agent: &GraphcastAgent, running: Arc<AtomicBool>) {
.await
{
error!(error = tracing::field::debug(&e), "Failed to send message");
} else {
debug!("Ping message sent successfully")
};
// agent.send_message(msg).await;
} else {
Expand All @@ -217,7 +217,9 @@ async fn main_loop(agent: &GraphcastAgent, running: Arc<AtomicBool>) {
.await
{
error!(error = tracing::field::debug(&e), "Failed to send message");
};
} else {
debug!("Pong message sent successfully")
}
};
}

Expand Down
Loading

0 comments on commit 4608d4e

Please sign in to comment.