|
14 | 14 | use core::ops; |
15 | 15 |
|
16 | 16 | use NumOpResult as R; |
17 | | -use crate::NumOpError as E; |
18 | 17 |
|
19 | | -use crate::{Amount, FeeRate, MathOp, NumOpResult, OptionExt, Weight}; |
| 18 | +use crate::{Amount, FeeRate, MathOp, NumOpError as E, NumOpResult, OptionExt, Weight}; |
20 | 19 |
|
21 | 20 | impl Amount { |
22 | 21 | /// Checked weight ceiling division. |
@@ -119,7 +118,9 @@ impl FeeRate { |
119 | 118 | /// [`NumOpResult::Error`] if an overflow occurred. |
120 | 119 | /// |
121 | 120 | /// This is equivalent to `Self::checked_mul_by_weight()`. |
122 | | - pub fn to_fee(self, weight: Weight) -> NumOpResult<Amount> { self.checked_mul_by_weight(weight) } |
| 121 | + pub fn to_fee(self, weight: Weight) -> NumOpResult<Amount> { |
| 122 | + self.checked_mul_by_weight(weight) |
| 123 | + } |
123 | 124 |
|
124 | 125 | /// Calculates the fee by multiplying this fee rate by weight, in weight units, returning [`None`] |
125 | 126 | /// if an overflow occurred. |
@@ -150,7 +151,7 @@ impl FeeRate { |
150 | 151 | /// |
151 | 152 | /// Returns [`NumOpResult::Error`] if overflow occurred. |
152 | 153 | pub const fn checked_mul_by_weight(self, weight: Weight) -> NumOpResult<Amount> { |
153 | | - if let Some(fee) = self.to_sat_per_kwu().checked_mul(weight.to_wu()) { |
| 154 | + if let Some(fee) = self.to_sat_per_kwu().checked_mul(weight.to_wu()) { |
154 | 155 | if let Some(round_up) = fee.checked_add(999) { |
155 | 156 | if let Ok(ret) = Amount::from_sat(round_up / 1_000) { |
156 | 157 | return NumOpResult::Valid(ret); |
|
0 commit comments