Skip to content

Commit cff88aa

Browse files
committed
Avoid an unnecessary unwrap
1 parent a799fc9 commit cff88aa

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lightning/src/onion_message/packet.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,12 @@ ReadableArgs<(SharedSecret, &H, &L)> for Payload<<H as CustomOnionMessageHandler
250250
Ok(Payload::Forward(ForwardControlTlvs::Unblinded(tlvs)))
251251
},
252252
Some(ChaChaPolyReadAdapter { readable: ControlTlvs::Receive(tlvs)}) => {
253-
if message.is_none() { return Err(DecodeError::InvalidValue) }
254253
Ok(Payload::Receive {
255254
control_tlvs: ReceiveControlTlvs::Unblinded(tlvs),
256255
reply_path,
257-
message: message.unwrap(),
256+
message: message.ok_or(DecodeError::InvalidValue)?,
258257
})
259-
}
258+
},
260259
}
261260
}
262261
}

0 commit comments

Comments
 (0)