Update waku example (#24)

* Update waku example

* Clippy happy
This commit is contained in:
Daniel Sanchez 2023-10-04 10:54:33 +02:00 committed by GitHub
parent fe5af61e54
commit 9b865c3ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 1488 deletions

1484
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
tokio = { version = "1", features = ["rt"] }
waku = { git = "https://github.com/waku-org/waku-rust-bindings" }
waku-bindings = "0.3.1"
serde = "1"
bincode = "1"
overwatch-rs = { path = "../../overwatch-rs" }

View File

@ -1,5 +1,5 @@
use super::*;
use ::waku::*;
use ::waku_bindings::*;
use std::str::FromStr;
use std::sync::{Arc, RwLock};
use std::time::SystemTime;
@ -20,7 +20,7 @@ impl NetworkBackend for Waku {
for peer in config.peers {
let addr = Multiaddr::from_str(&peer).unwrap();
let peer_id = waku.add_peer(&addr, waku::ProtocolId::Relay).unwrap();
waku.connect_peer_with_id(peer_id, None).unwrap();
waku.connect_peer_with_id(&peer_id, None).unwrap();
}
waku.relay_subscribe(None).unwrap();
assert!(waku.relay_enough_peers(None).unwrap());
@ -66,6 +66,8 @@ impl NetworkBackend for Waku {
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_secs() as usize,
"",
false,
);
let msg_id = self
.waku

View File

@ -58,7 +58,7 @@ impl<StateInput: ServiceState> StateOperator for NoOperator<StateInput> {
type StateInput = StateInput;
fn from_settings<Settings>(_settings: Settings) -> Self {
NoOperator(PhantomData::default())
NoOperator(PhantomData)
}
fn run<'borrow, 'fut>(