X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fonion_message%2Fpacket.rs;h=8a5628f164ca358dd8df1d7aec5e58730247c67e;hb=c383f06538ac664fe3312daf765595ba106d5b98;hp=9322f9489bcd42d80f5dfc6161650dedd1f0f15b;hpb=a799fc9b30f039bb921f0745439a64b4964d75ca;p=rust-lightning diff --git a/lightning/src/onion_message/packet.rs b/lightning/src/onion_message/packet.rs index 9322f948..8a5628f1 100644 --- a/lightning/src/onion_message/packet.rs +++ b/lightning/src/onion_message/packet.rs @@ -169,7 +169,7 @@ impl Writeable for (Payload, [u8; 32]) { match &self.0 { Payload::Forward(ForwardControlTlvs::Blinded(encrypted_bytes)) => { _encode_varint_length_prefixed_tlv!(w, { - (4, *encrypted_bytes, vec_type) + (4, *encrypted_bytes, required_vec) }) }, Payload::Receive { @@ -177,7 +177,7 @@ impl Writeable for (Payload, [u8; 32]) { } => { _encode_varint_length_prefixed_tlv!(w, { (2, reply_path, option), - (4, *encrypted_bytes, vec_type), + (4, *encrypted_bytes, required_vec), (message.tlv_type(), message, required) }) }, @@ -203,7 +203,7 @@ impl Writeable for (Payload, [u8; 32]) { } // Uses the provided secret to simultaneously decode and decrypt the control TLVs and data TLV. -impl +impl ReadableArgs<(SharedSecret, &H, &L)> for Payload<::CustomMessage> { fn read(r: &mut R, args: (SharedSecret, &H, &L)) -> Result { let (encrypted_tlvs_ss, handler, logger) = args; @@ -250,13 +250,12 @@ ReadableArgs<(SharedSecret, &H, &L)> for Payload< { - if message.is_none() { return Err(DecodeError::InvalidValue) } Ok(Payload::Receive { control_tlvs: ReceiveControlTlvs::Unblinded(tlvs), reply_path, - message: message.unwrap(), + message: message.ok_or(DecodeError::InvalidValue)?, }) - } + }, } } }