Ok(OnionMessagePath {
intermediate_nodes: vec![],
destination,
- addresses: Some(vec![SocketAddress::TcpIpV4 { addr: [127, 0, 0, 1], port: 1000 }]),
+ first_node_addresses:
+ Some(vec![SocketAddress::TcpIpV4 { addr: [127, 0, 0, 1], port: 1000 }]),
})
}
}
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::Node(nodes[1].node_id),
- addresses: None,
+ first_node_addresses: None,
};
nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap();
nodes[1].custom_message_handler.expect_message(TestCustomMessage::Response);
let path = OnionMessagePath {
intermediate_nodes: vec![nodes[1].node_id],
destination: Destination::Node(nodes[2].node_id),
- addresses: None,
+ first_node_addresses: None,
};
nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap();
nodes[2].custom_message_handler.expect_message(TestCustomMessage::Response);
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::BlindedPath(blinded_path),
- addresses: None,
+ first_node_addresses: None,
};
nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap();
nodes[1].custom_message_handler.expect_message(TestCustomMessage::Response);
let path = OnionMessagePath {
intermediate_nodes: vec![nodes[1].node_id, nodes[2].node_id],
destination: Destination::BlindedPath(blinded_path),
- addresses: None,
+ first_node_addresses: None,
};
nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap();
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::BlindedPath(blinded_path),
- addresses: None,
+ first_node_addresses: None,
};
nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap();
let path = OnionMessagePath {
intermediate_nodes: hops,
destination: Destination::Node(hop_node_id),
- addresses: None,
+ first_node_addresses: None,
};
let err = nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap_err();
assert_eq!(err, SendError::TooBigPacket);
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::BlindedPath(blinded_path),
- addresses: None,
+ first_node_addresses: None,
};
nodes[0].messenger.send_onion_message_using_path(path, test_msg.clone(), None).unwrap();
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::BlindedPath(blinded_path),
- addresses: None,
+ first_node_addresses: None,
};
nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap();
nodes[1].custom_message_handler.expect_message(TestCustomMessage::Response);
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::BlindedPath(blinded_path),
- addresses: None,
+ first_node_addresses: None,
};
let err = nodes[0].messenger.send_onion_message_using_path(path, test_msg.clone(), None).unwrap_err();
assert_eq!(err, SendError::TooFewBlindedHops);
let path = OnionMessagePath {
intermediate_nodes: vec![nodes[1].node_id, nodes[2].node_id],
destination: Destination::Node(nodes[3].node_id),
- addresses: None,
+ first_node_addresses: None,
};
let reply_path = BlindedPath::new_for_message(&[nodes[2].node_id, nodes[1].node_id, nodes[0].node_id], &*nodes[0].entropy_source, &secp_ctx).unwrap();
nodes[0].messenger.send_onion_message_using_path(path, test_msg.clone(), Some(reply_path)).unwrap();
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::BlindedPath(blinded_path),
- addresses: None,
+ first_node_addresses: None,
};
let reply_path = BlindedPath::new_for_message(&[nodes[2].node_id, nodes[1].node_id, nodes[0].node_id], &*nodes[0].entropy_source, &secp_ctx).unwrap();
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::Node(nodes[1].node_id),
- addresses: None,
+ first_node_addresses: None,
};
let err = nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap_err();
assert_eq!(err, SendError::InvalidMessage);
let path = OnionMessagePath {
intermediate_nodes: vec![],
destination: Destination::Node(nodes[1].node_id),
- addresses: None,
+ first_node_addresses: None,
};
for _ in 0..188 { // Based on MAX_PER_PEER_BUFFER_SIZE in OnionMessenger
nodes[0].messenger.send_onion_message_using_path(path.clone(), test_msg.clone(), None).unwrap();
let path = OnionMessagePath {
intermediate_nodes,
destination: Destination::Node(nodes[num_nodes-1].node_id),
- addresses: None,
+ first_node_addresses: None,
};
nodes[0].messenger.send_onion_message_using_path(path, test_msg, None).unwrap();
nodes[num_nodes-1].custom_message_handler.expect_message(TestCustomMessage::Response);
/// # Ok(OnionMessagePath {
/// # intermediate_nodes: vec![hop_node_id1, hop_node_id2],
/// # destination,
-/// # addresses: None,
+/// # first_node_addresses: None,
/// # })
/// # }
/// # }
) -> Result<OnionMessagePath, ()> {
let first_node = destination.first_node();
if peers.contains(&first_node) {
- Ok(OnionMessagePath { intermediate_nodes: vec![], destination, addresses: None })
+ Ok(OnionMessagePath {
+ intermediate_nodes: vec![], destination, first_node_addresses: None
+ })
} else {
let network_graph = self.network_graph.deref().read_only();
let node_announcement = network_graph
match node_announcement {
Some(node_announcement) if node_announcement.features.supports_onion_messages() => {
- let addresses = Some(node_announcement.addresses.clone());
- Ok(OnionMessagePath { intermediate_nodes: vec![], destination, addresses })
+ let first_node_addresses = Some(node_announcement.addresses.clone());
+ Ok(OnionMessagePath {
+ intermediate_nodes: vec![], destination, first_node_addresses
+ })
},
_ => Err(()),
}
///
/// Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use
/// this to initiate such a connection.
- pub addresses: Option<Vec<SocketAddress>>,
+ pub first_node_addresses: Option<Vec<SocketAddress>>,
}
impl OnionMessagePath {
ES::Target: EntropySource,
NS::Target: NodeSigner,
{
- let OnionMessagePath { intermediate_nodes, mut destination, addresses } = path;
+ let OnionMessagePath { intermediate_nodes, mut destination, first_node_addresses } = path;
if let Destination::BlindedPath(BlindedPath { ref blinded_hops, .. }) = destination {
if blinded_hops.is_empty() {
return Err(SendError::TooFewBlindedHops);
packet_payloads, packet_keys, prng_seed).map_err(|()| SendError::TooBigPacket)?;
let message = OnionMessage { blinding_point, onion_routing_packet };
- Ok((first_node_id, message, addresses))
+ Ok((first_node_id, message, first_node_addresses))
}
/// Decode one layer of an incoming [`OnionMessage`].