Skip to content

Commit 5db5cc2

Browse files
committed
WIP: Fuzz test onion message replies
1 parent 19e7aaf commit 5db5cc2

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
@@ -101,7 +101,7 @@ struct TestCustomMessageHandler {}
101101
impl CustomOnionMessageHandler for TestCustomMessageHandler {
102102
type CustomMessage = TestCustomMessage;
103103
fn handle_custom_message(&self, _msg: Self::CustomMessage) -> Option<Self::CustomMessage> {
104-
None
104+
Some(TestCustomMessage {})
105105
}
106106
fn read_custom_message<R: io::Read>(&self, _message_type: u64, buffer: &mut R) -> Result<Option<Self::CustomMessage>, msgs::DecodeError> {
107107
let mut buf = Vec::new();
@@ -111,9 +111,7 @@ impl CustomOnionMessageHandler for TestCustomMessageHandler {
111111
}
112112

113113
impl ResponseErrorHandler for TestCustomMessageHandler {
114-
fn handle_response_error(&self, _error: ResponseError) {
115-
unreachable!()
116-
}
114+
fn handle_response_error(&self, _error: ResponseError) {}
117115
}
118116

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

214215
let two_unblinded_hops_om = "020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000000000000000000000000000000000000000000000000000e0135043304210200000000000000000000000000000000000000000000000000000000000000029500000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003604104b000000000000000000000000000000fd1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000";

0 commit comments

Comments
 (0)