X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fonion_message%2Fpacket.rs;h=27c329335c358c0956e4ed09e03447ec96a1ed57;hb=1b245da37041f0f7a3046ee01298880021927f2f;hp=ea317afbf4038189a6094d067d1412730096796e;hpb=a0d38d7eb9bba986447470a261978e7c73a49d76;p=rust-lightning diff --git a/lightning/src/onion_message/packet.rs b/lightning/src/onion_message/packet.rs index ea317afb..27c32933 100644 --- a/lightning/src/onion_message/packet.rs +++ b/lightning/src/onion_message/packet.rs @@ -118,6 +118,8 @@ pub enum OnionMessageContents { impl OnionMessageContents { /// Returns the type that was used to decode the message payload. + /// + /// (C-not exported) as methods on non-cloneable enums are not currently exportable pub fn tlv_type(&self) -> u64 { match self { &OnionMessageContents::Custom(ref msg) => msg.tlv_type(), @@ -125,6 +127,7 @@ impl OnionMessageContents { } } +/// (C-not exported) as methods on non-cloneable enums are not currently exportable impl Writeable for OnionMessageContents { fn write(&self, w: &mut W) -> Result<(), io::Error> { match self { @@ -141,7 +144,7 @@ pub trait CustomOnionMessageContents: Writeable { /// Forward control TLVs in their blinded and unblinded form. pub(super) enum ForwardControlTlvs { - /// If we're sending to a blinded route, the node that constructed the blinded route has provided + /// If we're sending to a blinded path, the node that constructed the blinded path has provided /// this hop's control TLVs, already encrypted into bytes. Blinded(Vec), /// If we're constructing an onion message hop through an intermediate unblinded node, we'll need @@ -163,14 +166,14 @@ impl Writeable for (Payload, [u8; 32]) { fn write(&self, w: &mut W) -> Result<(), io::Error> { match &self.0 { Payload::Forward(ForwardControlTlvs::Blinded(encrypted_bytes)) => { - encode_varint_length_prefixed_tlv!(w, { + _encode_varint_length_prefixed_tlv!(w, { (4, *encrypted_bytes, vec_type) }) }, Payload::Receive { control_tlvs: ReceiveControlTlvs::Blinded(encrypted_bytes), reply_path, message, } => { - encode_varint_length_prefixed_tlv!(w, { + _encode_varint_length_prefixed_tlv!(w, { (2, reply_path, option), (4, *encrypted_bytes, vec_type), (message.tlv_type(), message, required) @@ -178,7 +181,7 @@ impl Writeable for (Payload, [u8; 32]) { }, Payload::Forward(ForwardControlTlvs::Unblinded(control_tlvs)) => { let write_adapter = ChaChaPolyWriteAdapter::new(self.1, &control_tlvs); - encode_varint_length_prefixed_tlv!(w, { + _encode_varint_length_prefixed_tlv!(w, { (4, write_adapter, required) }) }, @@ -186,7 +189,7 @@ impl Writeable for (Payload, [u8; 32]) { control_tlvs: ReceiveControlTlvs::Unblinded(control_tlvs), reply_path, message, } => { let write_adapter = ChaChaPolyWriteAdapter::new(self.1, &control_tlvs); - encode_varint_length_prefixed_tlv!(w, { + _encode_varint_length_prefixed_tlv!(w, { (2, reply_path, option), (4, write_adapter, required), (message.tlv_type(), message, required) @@ -209,7 +212,7 @@ impl ReadableArgs<(SharedSecret, &H)> for Payload< let rho = onion_utils::gen_rho_from_shared_secret(&encrypted_tlvs_ss.secret_bytes()); let mut message_type: Option = None; let mut message = None; - decode_tlv_stream!(&mut rd, { + decode_tlv_stream_with_custom_tlv_decode!(&mut rd, { (2, reply_path, option), (4, read_adapter, (option: LengthReadableArgs, rho)), }, |msg_type, msg_reader| {