Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Fix some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Apr 29, 2021
1 parent 45c7a11 commit 7fead98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions client/finality-grandpa/src/communication/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ fn good_commit_leads_to_relay() {
let _ = sender.unbounded_send(NetworkEvent::NotificationStreamOpened {
remote: sender_id.clone(),
protocol: GRANDPA_PROTOCOL_NAME.into(),
negotiated_fallback: None,
role: ObservedRole::Full,
});

Expand All @@ -308,6 +309,7 @@ fn good_commit_leads_to_relay() {
let _ = sender.unbounded_send(NetworkEvent::NotificationStreamOpened {
remote: receiver_id.clone(),
protocol: GRANDPA_PROTOCOL_NAME.into(),
negotiated_fallback: None,
role: ObservedRole::Full,
});

Expand Down Expand Up @@ -442,6 +444,7 @@ fn bad_commit_leads_to_report() {
let _ = sender.unbounded_send(NetworkEvent::NotificationStreamOpened {
remote: sender_id.clone(),
protocol: GRANDPA_PROTOCOL_NAME.into(),
negotiated_fallback: None,
role: ObservedRole::Full,
});
let _ = sender.unbounded_send(NetworkEvent::NotificationsReceived {
Expand Down
13 changes: 9 additions & 4 deletions client/network/src/service/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,15 @@ fn fallback_name_working() {
// Node 1 supports the protocols "new" and "old". Node 2 only supports "old". Checks whether
// they can connect.

const NEW_PROTOCOL_NAME: Cow<'static, str> =
Cow::Borrowed("/new-shiny-protocol-that-isnt-PROTOCOL_NAME");

let listen_addr = config::build_multiaddr![Memory(rand::random::<u64>())];

let (node1, mut events_stream1) = build_test_full_node(config::NetworkConfiguration {
extra_sets: vec![
config::NonDefaultSetConfig {
notifications_protocol: "/new-shiny-protocol-that-isnt-PROTOCOL_NAME".into(),
notifications_protocol: NEW_PROTOCOL_NAME.clone(),
fallback_names: vec![PROTOCOL_NAME],
max_notification_size: 1024 * 1024,
set_config: Default::default()
Expand All @@ -481,7 +484,7 @@ fn fallback_name_working() {
.. config::NetworkConfiguration::new_local()
});

let (node2, mut events_stream2) = build_test_full_node(config::NetworkConfiguration {
let (_, mut events_stream2) = build_test_full_node(config::NetworkConfiguration {
extra_sets: vec![
config::NonDefaultSetConfig {
notifications_protocol: PROTOCOL_NAME,
Expand All @@ -505,7 +508,8 @@ fn fallback_name_working() {
// Wait for the `NotificationStreamOpened`.
loop {
match events_stream2.next().await.unwrap() {
Event::NotificationStreamOpened { negotiated_fallback, .. } => {
Event::NotificationStreamOpened { protocol, negotiated_fallback, .. } => {
assert_eq!(protocol, PROTOCOL_NAME);
assert_eq!(negotiated_fallback, None);
break
},
Expand All @@ -518,7 +522,8 @@ fn fallback_name_working() {
// Wait for the `NotificationStreamOpened`.
loop {
match events_stream1.next().await.unwrap() {
Event::NotificationStreamOpened { negotiated_fallback, .. } => {
Event::NotificationStreamOpened { protocol, negotiated_fallback, .. } => {
assert_eq!(protocol, NEW_PROTOCOL_NAME);
assert_eq!(negotiated_fallback, Some(PROTOCOL_NAME));
break
},
Expand Down

0 comments on commit 7fead98

Please sign in to comment.