Use ok_or_else instead of ok_or in a couple places in Monero

This commit is contained in:
Luke Parker 2023-01-10 06:57:25 -05:00
parent 422a562c78
commit 8ffa5553ff
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -115,7 +115,7 @@ impl Metadata {
let subaddress = if read_byte(r)? == 1 { let subaddress = if read_byte(r)? == 1 {
Some( Some(
SubaddressIndex::new(read_u32(r)?, read_u32(r)?) SubaddressIndex::new(read_u32(r)?, read_u32(r)?)
.ok_or(io::Error::new(io::ErrorKind::Other, "invalid subaddress in metadata"))?, .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "invalid subaddress in metadata"))?,
) )
} else { } else {
None None

View file

@ -123,7 +123,7 @@ impl SignableTransaction {
let clsag = ClsagMultisig::new(transcript.clone(), input.key(), inputs[i].clone()); let clsag = ClsagMultisig::new(transcript.clone(), input.key(), inputs[i].clone());
key_images.push(( key_images.push((
clsag.H, clsag.H,
keys.current_offset().unwrap_or(dfg::Scalar::zero()).0 + self.inputs[i].key_offset(), keys.current_offset().unwrap_or_else(dfg::Scalar::zero).0 + self.inputs[i].key_offset(),
)); ));
clsags.push(AlgorithmMachine::new(clsag, offset).map_err(TransactionError::FrostError)?); clsags.push(AlgorithmMachine::new(clsag, offset).map_err(TransactionError::FrostError)?);
} }