diff --git a/src/blockdata/witness.rs b/src/blockdata/witness.rs index 41582654..b37f5071 100644 --- a/src/blockdata/witness.rs +++ b/src/blockdata/witness.rs @@ -67,12 +67,12 @@ impl Decodable for Witness { let element_size = element_size_varint.0 as usize; let required_len = cursor .checked_add(element_size) - .ok_or_else(|| self::Error::OversizedVectorAllocation { + .ok_or(self::Error::OversizedVectorAllocation { requested: usize::max_value(), max: MAX_VEC_SIZE, })? .checked_add(element_size_varint_len) - .ok_or_else(|| self::Error::OversizedVectorAllocation { + .ok_or(self::Error::OversizedVectorAllocation { requested: usize::max_value(), max: MAX_VEC_SIZE, })?; diff --git a/src/util/sighash.rs b/src/util/sighash.rs index 63b1a147..d34690b8 100644 --- a/src/util/sighash.rs +++ b/src/util/sighash.rs @@ -440,7 +440,7 @@ impl> SighashCache { .tx .input .get(input_index) - .ok_or_else(|| Error::IndexOutOfInputsBounds { + .ok_or(Error::IndexOutOfInputsBounds { index: input_index, inputs_size: self.tx.input.len(), })?; @@ -473,7 +473,7 @@ impl> SighashCache { self.tx .output .get(input_index) - .ok_or_else(|| Error::SingleWithoutCorrespondingOutput { + .ok_or(Error::SingleWithoutCorrespondingOutput { index: input_index, outputs_size: self.tx.output.len(), })? @@ -597,7 +597,7 @@ impl> SighashCache { .tx .input .get(input_index) - .ok_or_else(|| Error::IndexOutOfInputsBounds { + .ok_or(Error::IndexOutOfInputsBounds { index: input_index, inputs_size: self.tx.input.len(), })?;