From cff88aa5097ca09cfbd869eea9b24f61e6977b2f Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Thu, 18 May 2023 13:15:00 -0500 Subject: [PATCH] Avoid an unnecessary unwrap --- lightning/src/onion_message/packet.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lightning/src/onion_message/packet.rs b/lightning/src/onion_message/packet.rs index 9322f9489..e5fb93f45 100644 --- a/lightning/src/onion_message/packet.rs +++ b/lightning/src/onion_message/packet.rs @@ -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)?, }) - } + }, } } } -- 2.39.5