refactor: Use map combinator instead of match

This commit is contained in:
yancy 2025-05-13 15:13:36 -05:00
parent bc93498b3e
commit 642c414f56
1 changed files with 4 additions and 6 deletions

View File

@ -786,12 +786,10 @@ pub fn effective_value(
) -> NumOpResult<SignedAmount> { ) -> NumOpResult<SignedAmount> {
let weight = input_weight_prediction.total_weight(); let weight = input_weight_prediction.total_weight();
let fee = match fee_rate.to_fee(weight) { fee_rate
NumOpResult::Valid(x) => x.to_signed(), .to_fee(weight)
NumOpResult::Error(e) => return NumOpResult::Error(e) .map(Amount::to_signed)
}; .and_then(|fee| value.to_signed() - fee) // Cannot overflow.
value.to_signed() - fee // Cannot overflow.
} }
/// Predicts the weight of a to-be-constructed transaction. /// Predicts the weight of a to-be-constructed transaction.