Skip to content

Commit 661d138

Browse files
author
Mirko von Leipzig
committed
feat: add missing messages for conformance 009
1 parent a579337 commit 661d138

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Quick overview of the current status, providing implementation progress and test
5959
| [![conf_006](https://img.shields.io/badge/006-██████████-green) ](SPEC.md#ZG-CONFORMANCE-006)| :warning: Need to confirm expected behaviour with zcash.
6060
| [![conf_007](https://img.shields.io/badge/007-██████████-red) ](SPEC.md#ZG-CONFORMANCE-007)| :warning: Need to confirm expected behaviour with zcash.
6161
| [![conf_008](https://img.shields.io/badge/008-████░░░░░░-red) ](SPEC.md#ZG-CONFORMANCE-008)| :warning: Need to confirm expected behaviour with zcash.
62-
| [![conf_009](https://img.shields.io/badge/009-██████░░░░-green) ](SPEC.md#ZG-CONFORMANCE-009)|
62+
| [![conf_009](https://img.shields.io/badge/009-██████████-green) ](SPEC.md#ZG-CONFORMANCE-009)|
6363
| [![conf_010](https://img.shields.io/badge/010-██████████-red) ](SPEC.md#ZG-CONFORMANCE-010)|
6464
| [![conf_011](https://img.shields.io/badge/011-░░░░░░░░░░-inactive)](SPEC.md#ZG-CONFORMANCE-011)|
6565
| [![conf_012](https://img.shields.io/badge/012-██████████-red) ](SPEC.md#ZG-CONFORMANCE-012)| :warning: Zcashd node config requires investigation.

src/tests/conformance/messages.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,16 @@ async fn ignores_unsolicited_responses() {
158158
.await
159159
.unwrap();
160160

161-
// TODO: rest of the message types
162161
let test_messages = vec![
163162
Message::Pong(Nonce::default()),
164163
Message::Headers(Headers::empty()),
165164
Message::Addr(Addr::empty()),
166-
// Block(Block),
167-
// NotFound(Inv),
168-
// Tx(Tx),
165+
Message::Block(Box::new(Block::testnet_genesis())),
166+
Message::NotFound(Inv::new(vec![Block::testnet_1().txs[0].inv_hash()])),
167+
Message::Tx(Block::testnet_2().txs[0].clone()),
169168
];
170169

171-
let filter = MessageFilter::with_all_auto_reply().enable_logging();
170+
let filter = MessageFilter::with_all_auto_reply();
172171

173172
for message in test_messages {
174173
message.write_to_stream(&mut stream).await.unwrap();
@@ -179,10 +178,8 @@ async fn ignores_unsolicited_responses() {
179178
.await
180179
.unwrap();
181180

182-
match filter.read_from_stream(&mut stream).await.unwrap() {
183-
Message::Pong(returned_nonce) => assert_eq!(nonce, returned_nonce),
184-
msg => panic!("Expected pong: {:?}", msg),
185-
}
181+
let pong = filter.read_from_stream(&mut stream).await.unwrap();
182+
assert_matches!(pong, Message::Pong(..));
186183
}
187184

188185
node.stop().await;

0 commit comments

Comments
 (0)