Skip to content

Commit 238b72e

Browse files
committed
WIP: Fuzz test onion message replies
1 parent a5cefff commit 238b72e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fuzz/src/onion_message.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct TestCustomMessageHandler {}
9999
impl CustomOnionMessageHandler for TestCustomMessageHandler {
100100
type CustomMessage = TestCustomMessage;
101101
fn handle_custom_message(&self, _msg: Self::CustomMessage) -> Option<Self::CustomMessage> {
102-
None
102+
Some(TestCustomMessage {})
103103
}
104104
fn read_custom_message<R: io::Read>(&self, _message_type: u64, buffer: &mut R) -> Result<Option<Self::CustomMessage>, msgs::DecodeError> {
105105
let mut buf = Vec::new();
@@ -109,9 +109,7 @@ impl CustomOnionMessageHandler for TestCustomMessageHandler {
109109
}
110110

111111
impl ResponseErrorHandler for TestCustomMessageHandler {
112-
fn handle_response_error(&self, _error: ResponseError) {
113-
unreachable!()
114-
}
112+
fn handle_response_error(&self, _error: ResponseError) {}
115113
}
116114

117115
pub struct VecWriter(pub Vec<u8>);
@@ -207,6 +205,9 @@ mod tests {
207205
let log_entries = logger.lines.lock().unwrap();
208206
assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(),
209207
"Received an onion message with path_id None and no reply_path".to_string())), Some(&1));
208+
// TODO: Add reply path to one_hop_om instead?
209+
assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(),
210+
"No reply path to respond to onion message with path_id None".to_string())), Some(&1));
210211
}
211212

212213
let two_unblinded_hops_om = "020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000000000000000000000000000000000000000000000000000e0135043304210200000000000000000000000000000000000000000000000000000000000000029500000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003604104b000000000000000000000000000000fd1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000";

0 commit comments

Comments
 (0)