nym-sphinx-wasm: chunking packet sends

This commit is contained in:
Dave Hrycyszyn
2020-04-16 13:42:09 +01:00
parent 146bbef3af
commit 40e67e7809
+6 -4
View File
@@ -69,10 +69,12 @@ pub fn create_sphinx_packet(rout: String, msg: &str, destination: &str) -> Vec<u
let dest_bytes = DestinationAddressBytes::from_base58_string(destination.to_owned());
let dest = Destination::new(dest_bytes, [4u8; IDENTIFIER_LENGTH]);
let message = msg.as_bytes().to_vec();
let sphinx_packet = match SphinxPacket::new(message.clone(), &route, &dest, &delays).unwrap() {
SphinxPacket { header, payload } => SphinxPacket { header, payload },
};
// let mut message = msg.as_bytes().to_vec();
let mut message = nymsphinx::chunking::split_and_prepare_payloads(&msg.as_bytes());
let sphinx_packet =
match SphinxPacket::new(message.pop().unwrap(), &route, &dest, &delays).unwrap() {
SphinxPacket { header, payload } => SphinxPacket { header, payload },
};
sphinx_packet.to_bytes()
}