Skip to content

Instantly share code, notes, and snippets.

@b-m-f
Last active October 25, 2019 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-m-f/f9a17b248806de5219dca1878a09f4cf to your computer and use it in GitHub Desktop.
Save b-m-f/f9a17b248806de5219dca1878a09f4cf to your computer and use it in GitHub Desktop.
#[cfg(test)]
mod tests {
// Note this useful idiom: importing names from outer (for mod tests) scope.
use super::*;
use enr::{Enr, EnrBuilder};
use libp2p_core::identity;
#[test]
fn test_updating_connection_on_ping() {
let keypair = identity::Keypair::generate_secp256k1();
let ip: IpAddr = "127.0.0.1".parse().unwrap();
let enr = EnrBuilder::new("v4")
.ip(ip.clone().into())
.udp(500)
.build(&keypair)
.unwrap();
let discv5: Discv5<String> = Discv5::new(enr, keypair.clone(), ip.into()).unwrap();
println!("{:?}", discv5.kbuckets);
assert_eq!(true, false);
// set a node to be disconnected
// call handle_RPC with a PONG and ensure that the corrent Node in the DHT is updated
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment