From: Jeffrey Czyz Date: Thu, 18 May 2023 18:15:00 +0000 (-0500) Subject: Avoid an unnecessary unwrap X-Git-Tag: v0.0.116-alpha1~11^2~10 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=cff88aa5097ca09cfbd869eea9b24f61e6977b2f;p=rust-lightning Avoid an unnecessary unwrap --- 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)?, }) - } + }, } } }