diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs index f2f8153c1..5efefb426 100644 --- a/units/src/amount/unsigned.rs +++ b/units/src/amount/unsigned.rs @@ -235,7 +235,7 @@ impl Amount { /// /// Be aware that integer division loses the remainder if no exact division /// can be made. This method rounds up ensuring the transaction fee-rate is - /// sufficient. If you wish to round-down, use the unchecked version instead. + /// sufficient. If you wish to round down use `amount / weight`. /// /// [`None`] is returned if an overflow occurred. #[cfg(feature = "alloc")] diff --git a/units/src/fee_rate.rs b/units/src/fee_rate.rs index 237de0f5b..b3974422c 100644 --- a/units/src/fee_rate.rs +++ b/units/src/fee_rate.rs @@ -211,6 +211,10 @@ impl Mul for FeeRate { impl Div for Amount { type Output = FeeRate; + /// Truncating integer division. + /// + /// This is likely the wrong thing for a user dividing an amount by a weight. Consider using + /// `checked_div_by_weight` instead. fn div(self, rhs: Weight) -> Self::Output { FeeRate(self.to_sat() * 1000 / rhs.to_wu()) } }