4c1c5ac1122b286689b97bcf7f0980981d37dc7e
[rust-lightning] / fuzz / src / onion_message.rs
1 // Imports that need to be added manually
2 use bech32::u5;
3 use bitcoin::blockdata::script::ScriptBuf;
4 use bitcoin::secp256k1::{PublicKey, Scalar, Secp256k1, SecretKey, self};
5 use bitcoin::secp256k1::ecdh::SharedSecret;
6 use bitcoin::secp256k1::ecdsa::RecoverableSignature;
7 use bitcoin::secp256k1::schnorr;
8
9 use lightning::blinded_path::{BlindedPath, EmptyNodeIdLookUp};
10 use lightning::blinded_path::message::ForwardNode;
11 use lightning::ln::features::InitFeatures;
12 use lightning::ln::msgs::{self, DecodeError, OnionMessageHandler};
13 use lightning::ln::script::ShutdownScript;
14 use lightning::offers::invoice::UnsignedBolt12Invoice;
15 use lightning::offers::invoice_request::UnsignedInvoiceRequest;
16 use lightning::sign::{Recipient, KeyMaterial, EntropySource, NodeSigner, SignerProvider};
17 use lightning::util::test_channel_signer::TestChannelSigner;
18 use lightning::util::logger::Logger;
19 use lightning::util::ser::{Readable, Writeable, Writer};
20 use lightning::onion_message::messenger::{CustomOnionMessageHandler, Destination, MessageRouter, OnionMessagePath, OnionMessenger, PendingOnionMessage, Responder, ResponseInstruction};
21 use lightning::onion_message::offers::{OffersMessage, OffersMessageHandler};
22 use lightning::onion_message::packet::OnionMessageContents;
23
24 use crate::utils::test_logger;
25
26 use std::io::{self, Cursor};
27 use std::sync::atomic::{AtomicU64, Ordering};
28
29 #[inline]
30 /// Actual fuzz test, method signature and name are fixed
31 pub fn do_test<L: Logger>(data: &[u8], logger: &L) {
32         if let Ok(msg) = <msgs::OnionMessage as Readable>::read(&mut Cursor::new(data)) {
33                 let mut secret_bytes = [1; 32];
34                 secret_bytes[31] = 2;
35                 let secret = SecretKey::from_slice(&secret_bytes).unwrap();
36                 let keys_manager = KeyProvider {
37                         node_secret: secret,
38                         counter: AtomicU64::new(0),
39                 };
40                 let node_id_lookup = EmptyNodeIdLookUp {};
41                 let message_router = TestMessageRouter {};
42                 let offers_msg_handler = TestOffersMessageHandler {};
43                 let custom_msg_handler = TestCustomMessageHandler {};
44                 let onion_messenger = OnionMessenger::new(
45                         &keys_manager, &keys_manager, logger, &node_id_lookup, &message_router,
46                         &offers_msg_handler, &custom_msg_handler
47                 );
48
49                 let peer_node_id = {
50                         let mut secret_bytes = [0; 32];
51                         secret_bytes[31] = 2;
52                         let secret = SecretKey::from_slice(&secret_bytes).unwrap();
53                         PublicKey::from_secret_key(&Secp256k1::signing_only(), &secret)
54                 };
55
56                 let mut features = InitFeatures::empty();
57                 features.set_onion_messages_optional();
58                 let init = msgs::Init { features, networks: None, remote_network_address: None };
59
60                 onion_messenger.peer_connected(&peer_node_id, &init, false).unwrap();
61                 onion_messenger.handle_onion_message(&peer_node_id, &msg);
62         }
63 }
64
65 /// Method that needs to be added manually, {name}_test
66 pub fn onion_message_test<Out: test_logger::Output>(data: &[u8], out: Out) {
67         let logger = test_logger::TestLogger::new("".to_owned(), out);
68         do_test(data, &logger);
69 }
70
71 /// Method that needs to be added manually, {name}_run
72 #[no_mangle]
73 pub extern "C" fn onion_message_run(data: *const u8, datalen: usize) {
74         let logger = test_logger::TestLogger::new("".to_owned(), test_logger::DevNull {});
75         do_test(unsafe { std::slice::from_raw_parts(data, datalen) }, &logger);
76 }
77
78 struct TestMessageRouter {}
79
80 impl MessageRouter for TestMessageRouter {
81         fn find_path(
82                 &self, _sender: PublicKey, _peers: Vec<PublicKey>, destination: Destination
83         ) -> Result<OnionMessagePath, ()> {
84                 Ok(OnionMessagePath {
85                         intermediate_nodes: vec![],
86                         destination,
87                         first_node_addresses: None,
88                 })
89         }
90
91         fn create_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
92                 &self, _recipient: PublicKey, _peers: Vec<ForwardNode>, _secp_ctx: &Secp256k1<T>,
93         ) -> Result<Vec<BlindedPath>, ()> {
94                 unreachable!()
95         }
96 }
97
98 struct TestOffersMessageHandler {}
99
100 impl OffersMessageHandler for TestOffersMessageHandler {
101         fn handle_message(&self, _message: OffersMessage, _responder: Option<Responder>) -> ResponseInstruction<OffersMessage> {
102                 ResponseInstruction::NoResponse
103         }
104 }
105
106 #[derive(Debug)]
107 struct TestCustomMessage {}
108
109 const CUSTOM_MESSAGE_TYPE: u64 = 4242;
110 const CUSTOM_MESSAGE_CONTENTS: [u8; 32] = [42; 32];
111
112 impl OnionMessageContents for TestCustomMessage {
113         fn tlv_type(&self) -> u64 {
114                 CUSTOM_MESSAGE_TYPE
115         }
116         fn msg_type(&self) -> &'static str {
117                 "Custom Message"
118         }
119 }
120
121 impl Writeable for TestCustomMessage {
122         fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
123                 Ok(CUSTOM_MESSAGE_CONTENTS.write(w)?)
124         }
125 }
126
127 struct TestCustomMessageHandler {}
128
129 impl CustomOnionMessageHandler for TestCustomMessageHandler {
130         type CustomMessage = TestCustomMessage;
131         fn handle_custom_message(&self, message: Self::CustomMessage, responder: Option<Responder>) -> ResponseInstruction<Self::CustomMessage> {
132                 match responder {
133                         Some(responder) => responder.respond(message),
134                         None => ResponseInstruction::NoResponse
135                 }
136         }
137         fn read_custom_message<R: io::Read>(&self, _message_type: u64, buffer: &mut R) -> Result<Option<Self::CustomMessage>, msgs::DecodeError> {
138                 let mut buf = Vec::new();
139                 buffer.read_to_end(&mut buf)?;
140                 return Ok(Some(TestCustomMessage {}))
141         }
142         fn release_pending_custom_messages(&self) -> Vec<PendingOnionMessage<Self::CustomMessage>> {
143                 vec![]
144         }
145 }
146
147 pub struct VecWriter(pub Vec<u8>);
148 impl Writer for VecWriter {
149         fn write_all(&mut self, buf: &[u8]) -> Result<(), ::std::io::Error> {
150                 self.0.extend_from_slice(buf);
151                 Ok(())
152         }
153 }
154 struct KeyProvider {
155         node_secret: SecretKey,
156         counter: AtomicU64,
157 }
158
159 impl EntropySource for KeyProvider {
160         fn get_secure_random_bytes(&self) -> [u8; 32] {
161                 let ctr = self.counter.fetch_add(1, Ordering::Relaxed);
162                 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
163                         (ctr >> 8*7) as u8, (ctr >> 8*6) as u8, (ctr >> 8*5) as u8, (ctr >> 8*4) as u8, (ctr >> 8*3) as u8, (ctr >> 8*2) as u8, (ctr >> 8*1) as u8, 14, (ctr >> 8*0) as u8]
164         }
165 }
166
167 impl NodeSigner for KeyProvider {
168         fn get_node_id(&self, recipient: Recipient) -> Result<PublicKey, ()> {
169                 let node_secret = match recipient {
170                         Recipient::Node => Ok(&self.node_secret),
171                         Recipient::PhantomNode => Err(())
172                 }?;
173                 Ok(PublicKey::from_secret_key(&Secp256k1::signing_only(), node_secret))
174         }
175
176         fn ecdh(&self, recipient: Recipient, other_key: &PublicKey, tweak: Option<&Scalar>) -> Result<SharedSecret, ()> {
177                 let mut node_secret = match recipient {
178                         Recipient::Node => Ok(self.node_secret.clone()),
179                         Recipient::PhantomNode => Err(())
180                 }?;
181                 if let Some(tweak) = tweak {
182                         node_secret = node_secret.mul_tweak(tweak).map_err(|_| ())?;
183                 }
184                 Ok(SharedSecret::new(other_key, &node_secret))
185         }
186
187         fn get_inbound_payment_key_material(&self) -> KeyMaterial { unreachable!() }
188
189         fn sign_invoice(&self, _hrp_bytes: &[u8], _invoice_data: &[u5], _recipient: Recipient) -> Result<RecoverableSignature, ()> {
190                 unreachable!()
191         }
192
193         fn sign_bolt12_invoice_request(
194                 &self, _invoice_request: &UnsignedInvoiceRequest
195         ) -> Result<schnorr::Signature, ()> {
196                 unreachable!()
197         }
198
199         fn sign_bolt12_invoice(
200                 &self, _invoice: &UnsignedBolt12Invoice,
201         ) -> Result<schnorr::Signature, ()> {
202                 unreachable!()
203         }
204
205         fn sign_gossip_message(&self, _msg: lightning::ln::msgs::UnsignedGossipMessage) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
206                 unreachable!()
207         }
208 }
209
210 impl SignerProvider for KeyProvider {
211         type EcdsaSigner = TestChannelSigner;
212         #[cfg(taproot)]
213         type TaprootSigner = TestChannelSigner;
214
215         fn generate_channel_keys_id(&self, _inbound: bool, _channel_value_satoshis: u64, _user_channel_id: u128) -> [u8; 32] { unreachable!() }
216
217         fn derive_channel_signer(&self, _channel_value_satoshis: u64, _channel_keys_id: [u8; 32]) -> Self::EcdsaSigner {
218                 unreachable!()
219         }
220
221         fn read_chan_signer(&self, _data: &[u8]) -> Result<TestChannelSigner, DecodeError> { unreachable!() }
222
223         fn get_destination_script(&self, _channel_keys_id: [u8; 32]) -> Result<ScriptBuf, ()> { unreachable!() }
224
225         fn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()> { unreachable!() }
226 }
227
228 #[cfg(test)]
229 mod tests {
230         use bitcoin::hashes::hex::FromHex;
231         use lightning::util::logger::{Logger, Record};
232         use std::collections::HashMap;
233         use std::sync::Mutex;
234
235         struct TrackingLogger {
236                 /// (module, message) -> count
237                 pub lines: Mutex<HashMap<(String, String), usize>>,
238         }
239         impl Logger for TrackingLogger {
240                 fn log(&self, record: Record) {
241                         *self.lines.lock().unwrap().entry((record.module_path.to_string(), format!("{}", record.args))).or_insert(0) += 1;
242                         println!("{:<5} [{} : {}, {}] {}", record.level.to_string(), record.module_path, record.file, record.line, record.args);
243                 }
244         }
245
246         #[test]
247         fn test_no_onion_message_breakage() {
248                 let one_hop_om = "\
249                         020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000\
250                         000000000000000000000000000000000000000000000000e01ae0276020000000000000000000000000000\
251                         000000000000000000000000000000000002020000000000000000000000000000000000000000000000000\
252                         000000000000e0101022a0000000000000000000000000000014551231950b75fc4402da1732fc9bebf0010\
253                         9500000000000000000000000000000004106d000000000000000000000000000000fd1092202a2a2a2a2a2\
254                         a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a0000000000000000000000000000000000\
255                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
256                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
257                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
258                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
259                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
260                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
261                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
262                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
263                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
264                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
265                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
266                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
267                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
268                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
269                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
270                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
271                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
272                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
273                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
274                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
275                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
276                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
277                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
278                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
279                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
280                         000000000000000000000000000000000000000005600000000000000000000000000000000000000000000\
281                         000000000000000000";
282                 let logger = TrackingLogger { lines: Mutex::new(HashMap::new()) };
283                 super::do_test(&<Vec<u8>>::from_hex(one_hop_om).unwrap(), &logger);
284                 {
285                         let log_entries = logger.lines.lock().unwrap();
286                         assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(),
287                                                 "Received an onion message with path_id None and a reply_path: Custom(TestCustomMessage)"
288                                                 .to_string())), Some(&1));
289                         assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(),
290                                                 "Constructing onion message when responding with Custom Message to an onion message with path_id None: TestCustomMessage".to_string())), Some(&1));
291                         assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(),
292                                                 "Buffered onion message when responding with Custom Message to an onion message with path_id None".to_string())), Some(&1));
293                 }
294
295                 let two_unblinded_hops_om = "\
296                         020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000\
297                         000000000000000000000000000000000000000000000000e01350433042102020202020202020202020202\
298                         02020202020202020202020202020202020202026d000000000000000000000000000000eb0000000000000\
299                         000000000000000000000000000000000000000000000000036041096000000000000000000000000000000\
300                         fd1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a000000000000000\
301                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
302                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
303                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
304                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
305                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
306                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
307                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
308                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
309                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
310                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
311                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
312                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
313                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
314                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
315                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
316                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
317                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
318                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
319                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
320                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
321                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
322                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
323                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
324                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
325                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
326                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
327                         000000000000000000000000000000000000000004800000000000000000000000000000000000000000000\
328                         000000000000000000";
329                 let logger = TrackingLogger { lines: Mutex::new(HashMap::new()) };
330                 super::do_test(&<Vec<u8>>::from_hex(two_unblinded_hops_om).unwrap(), &logger);
331                 {
332                         let log_entries = logger.lines.lock().unwrap();
333                         assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(), "Forwarding an onion message to peer 020202020202020202020202020202020202020202020202020202020202020202".to_string())), Some(&1));
334                 }
335
336                 let two_unblinded_two_blinded_om = "\
337                         020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000\
338                         000000000000000000000000000000000000000000000000e01350433042102020202020202020202020202\
339                         02020202020202020202020202020202020202026d0000000000000000000000000000009e0000000000000\
340                         000000000000000000000000000000000000000000000000058045604210203030303030303030303030303\
341                         030303030303030303030303030303030303020821020000000000000000000000000000000000000000000\
342                         000000000000000000e0196000000000000000000000000000000e900000000000000000000000000000000\
343                         000000000000000000000000000000350433042102040404040404040404040404040404040404040404040\
344                         4040404040404040402ca000000000000000000000000000000420000000000000000000000000000000000\
345                         00000000000000000000000000003604103f000000000000000000000000000000fd1092202a2a2a2a2a2a2\
346                         a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a000000000000000000000000000000000000\
347                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
348                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
349                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
350                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
351                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
352                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
353                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
354                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
355                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
356                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
357                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
358                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
359                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
360                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
361                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
362                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
363                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
364                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
365                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
366                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
367                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
368                         000000000000000000000000000000000000000004800000000000000000000000000000000000000000000\
369                         000000000000000000";
370                 let logger = TrackingLogger { lines: Mutex::new(HashMap::new()) };
371                 super::do_test(&<Vec<u8>>::from_hex(two_unblinded_two_blinded_om).unwrap(), &logger);
372                 {
373                         let log_entries = logger.lines.lock().unwrap();
374                         assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(), "Forwarding an onion message to peer 020202020202020202020202020202020202020202020202020202020202020202".to_string())), Some(&1));
375                 }
376
377                 let three_blinded_om = "\
378                         020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000\
379                         000000000000000000000000000000000000000000000000e01350433042102020202020202020202020202\
380                         02020202020202020202020202020202020202026d000000000000000000000000000000b20000000000000\
381                         000000000000000000000000000000000000000000000000035043304210203030303030303030303030303\
382                         030303030303030303030303030303030303029600000000000000000000000000000033000000000000000\
383                         000000000000000000000000000000000000000000000003604104e000000000000000000000000000000fd\
384                         1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a00000000000000000\
385                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
386                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
387                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
388                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
389                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
390                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
391                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
392                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
393                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
394                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
395                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
396                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
397                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
398                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
399                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
400                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
401                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
402                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
403                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
404                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
405                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
406                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
407                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
408                         000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
409                         000000000000000000000000000000000000000004800000000000000000000000000000000000000000000\
410                         000000000000000000";
411                 let logger = TrackingLogger { lines: Mutex::new(HashMap::new()) };
412                 super::do_test(&<Vec<u8>>::from_hex(three_blinded_om).unwrap(), &logger);
413                 {
414                         let log_entries = logger.lines.lock().unwrap();
415                         assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(), "Forwarding an onion message to peer 020202020202020202020202020202020202020202020202020202020202020202".to_string())), Some(&1));
416                 }
417         }
418 }