"Received an onion message with path_id None and a reply_path: Custom(TestCustomMessage)"
.to_string())), Some(&1));
assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(),
- "Constructing onion message when responding with Custom Message to an onion message with path_id None: TestCustomMessage".to_string())), Some(&1));
+ "Constructing onion message when responding with Custom Message to an onion message: TestCustomMessage".to_string())), Some(&1));
assert_eq!(log_entries.get(&("lightning::onion_message::messenger".to_string(),
- "Buffered onion message when responding with Custom Message to an onion message with path_id None".to_string())), Some(&1));
+ "Buffered onion message when responding with Custom Message to an onion message".to_string())), Some(&1));
}
let two_unblinded_hops_om = "\
// 2. Define the message sent from Bob to Alice.
let message = TestCustomMessage::Ping;
- let path_id = Some([2; 32]);
// 3. Simulate the creation of a Blinded Reply path provided by Bob.
let secp_ctx = Secp256k1::new();
let reply_path = BlindedPath::new_for_message(&[], nodes[1].node_id, &*nodes[1].entropy_source, &secp_ctx).unwrap();
// 4. Create a responder using the reply path for Alice.
- let responder = Some(Responder::new(reply_path, path_id));
+ let responder = Some(Responder::new(reply_path));
// 5. Expect Alice to receive the message and create a response instruction for it.
alice.custom_message_handler.expect_message(message.clone());
// Alice receives a message from Bob with an added reply_path for responding back.
let message = TestCustomMessage::Ping;
- let path_id = Some([2; 32]);
let reply_path = BlindedPath::new_for_message(&[], bob.node_id, &*bob.entropy_source, &secp_ctx).unwrap();
// Alice asynchronously responds to Bob, expecting a response back from him.
- let responder = Responder::new(reply_path, path_id);
+ let responder = Responder::new(reply_path);
alice.custom_message_handler.expect_message_and_response(message.clone());
let response_instruction = alice.custom_message_handler.handle_custom_message(message, Some(responder));
// Alice receives a message from Bob with an added reply_path for responding back.
let message = TestCustomMessage::Ping;
- let path_id = Some([2; 32]);
let reply_path = BlindedPath::new_for_message(&[], bob.node_id, &*bob.entropy_source, &secp_ctx).unwrap();
// Alice tries to asynchronously respond to Bob, but fails because the nodes are unannounced and
// disconnected. Thus, a reply path could no be created for the response.
disconnect_peers(alice, bob);
- let responder = Responder::new(reply_path, path_id);
+ let responder = Responder::new(reply_path);
alice.custom_message_handler.expect_message_and_response(message.clone());
let response_instruction = alice.custom_message_handler.handle_custom_message(message, Some(responder));
pub struct Responder {
/// The path along which a response can be sent.
reply_path: BlindedPath,
- path_id: Option<[u8; 32]>
}
impl_writeable_tlv_based!(Responder, {
(0, reply_path, required),
- (2, path_id, option),
});
impl Responder {
/// Creates a new [`Responder`] instance with the provided reply path.
- pub(super) fn new(reply_path: BlindedPath, path_id: Option<[u8; 32]>) -> Self {
+ pub(super) fn new(reply_path: BlindedPath) -> Self {
Responder {
reply_path,
- path_id,
}
}
ResponseInstruction::WithoutReplyPath(OnionMessageResponse {
message: response,
reply_path: self.reply_path,
- path_id: self.path_id,
})
}
ResponseInstruction::WithReplyPath(OnionMessageResponse {
message: response,
reply_path: self.reply_path,
- path_id: self.path_id,
})
}
}
pub struct OnionMessageResponse<T: OnionMessageContents> {
message: T,
reply_path: BlindedPath,
- path_id: Option<[u8; 32]>,
}
/// `ResponseInstruction` represents instructions for responding to received messages.
Err(err) => {
log_trace!(
self.logger,
- "Failed to create reply path when responding with {} to an onion message \
- with path_id {:02x?}: {:?}",
- message_type, response.path_id, err
+ "Failed to create reply path when responding with {} to an onion message: {:?}",
+ message_type, err
);
return Err(err);
}
self.find_path_and_enqueue_onion_message(
response.message, Destination::BlindedPath(response.reply_path), reply_path,
format_args!(
- "when responding with {} to an onion message with path_id {:02x?}",
+ "when responding with {} to an onion message",
message_type,
- response.path_id
)
).map(|result| Some(result))
}
"Received an onion message with path_id {:02x?} and {} reply_path: {:?}",
path_id, if reply_path.is_some() { "a" } else { "no" }, message);
- let responder = reply_path.map(
- |reply_path| Responder::new(reply_path, path_id)
- );
+ let responder = reply_path.map(Responder::new);
match message {
ParsedOnionMessageContents::Offers(msg) => {
let response_instructions = self.offers_handler.handle_message(msg, responder);