summaryrefslogtreecommitdiffstats
path: root/src/simtest/identity.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/simtest/identity.rs')
-rw-r--r--src/simtest/identity.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/simtest/identity.rs b/src/simtest/identity.rs
index ed35389..ec5d665 100644
--- a/src/simtest/identity.rs
+++ b/src/simtest/identity.rs
@@ -14,7 +14,9 @@ use crate::swarm::bootstrap::Start;
use crate::swarm::members;
use crate::transport::identity::{WHO_LABEL, signed};
use crate::transport::sim::SimNet;
-use crate::transport::{HeadsSummary, IdentityProof, Keepalive, ParsedMessage, Transport};
+use crate::transport::{
+ Destination, HeadsSummary, IdentityProof, Keepalive, ParsedMessage, Transport,
+};
const SOON: Duration = Duration::from_secs(20);
@@ -41,6 +43,18 @@ async fn nodes_are_their_node_ids() {
for node in [&a, &b, &c] {
peers_are_node_ids(node).await;
}
+ // Where a sends to b: where b proved itself, on the sim's transport.
+ assert_eq!(
+ a.transport.destination(b.local_id()),
+ Some(Destination {
+ address: "sim:b".into(),
+ proven: true,
+ connection: None,
+ })
+ );
+ let stats = a.transport.stats();
+ assert_eq!(stats.identity.unwrap().proven["sim"], 2);
+ assert!(stats.libp2p.is_none());
let (b_id, c_id) = (b.local_id().to_owned(), c.local_id().to_owned());
let a = &a;
sim.wait_until(
@@ -118,6 +132,9 @@ async fn a_proof_holds_only_at_its_address() {
sim.net.inject("ghost", "a", &ping(&a)).await.unwrap();
assert!(a.get_peer_state(&ghost.id()).await.is_none());
}
+ let counts = a.transport.stats().identity.unwrap().counts;
+ assert_eq!(counts.proofs_rejected, 2);
+ assert!(counts.dropped_unproven >= 2);
sim.net
.inject("ghost", "a", &who(&ghost, "sim:ghost", "sim:a"))