try to fix discv5 test case

This commit is contained in:
al8n 2022-12-22 04:40:06 +13:00
parent 2171f6c69e
commit 8089defcad
2 changed files with 9 additions and 4 deletions

View File

@ -119,6 +119,11 @@ impl WakuNodeHandle<Running> {
stop_node()
}
/// Starts the DiscoveryV5 service to discover and connect to new peers
pub fn discv5_start(&self) -> Result<bool> {
discv5::waku_discv5_start()
}
/// Stops the DiscoveryV5 service
pub fn discv5_stop(&self) -> Result<bool> {
discv5::waku_discv5_stop()

View File

@ -29,17 +29,17 @@ pub fn main() -> Result<(), String> {
min_peers_to_publish: None,
filter: None,
log_level: Some(WakuLogLevel::Error),
discv5: Some(false),
discv5: Some(true),
discv5_udp_port: Some(9000),
discv5_bootstrap_nodes: Vec::new(),
};
let node = waku_new(Some(config))?;
let result = node.discv5_start()?;
println!("Discv5 started: {}", result);
let node = node.start()?;
println!("Node peer id: {}", node.peer_id()?);
let result = node.discv5_start()?;
println!("Discv5 started: {}", result);
for node_address in NODES {
let address: Multiaddr = node_address.parse().unwrap();
let peer_id = node.add_peer(&address, ProtocolId::Relay)?;