refactor: Use map combinator instead of match
This commit is contained in:
parent
bc93498b3e
commit
642c414f56
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue