From a8379bf0053e66cf5984ce449d19e54e529b6b70 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Mon, 18 Nov 2024 10:50:26 +0000 Subject: [PATCH] Mark `checked_` functions const in bitcoin. Replace `?` operators, which are not allowed in const context, with match statements. --- bitcoin/src/psbt/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs index c9eac7165..5adc81654 100644 --- a/bitcoin/src/psbt/mod.rs +++ b/bitcoin/src/psbt/mod.rs @@ -627,8 +627,11 @@ impl Psbt { /// Gets the input at `input_index` after checking that it is a valid index. fn checked_input(&self, input_index: usize) -> Result<&Input, IndexOutOfBoundsError> { - self.check_index_is_within_bounds(input_index)?; - Ok(&self.inputs[input_index]) + // No `?` operator in const context. + match self.check_index_is_within_bounds(input_index) { + Ok(_) => Ok(&self.inputs[input_index]), + Err(e) => Err(e), + } } /// Checks `input_index` is within bounds for the PSBT `inputs` array and