refactor: use convenience method to calculate fee
The FeeRate module provides a convenience method to calculate the fee.
This commit is contained in:
parent
16cf1f7f2a
commit
ee0486a43f
|
@ -790,7 +790,7 @@ pub fn effective_value(
|
||||||
value: Amount,
|
value: Amount,
|
||||||
) -> Option<SignedAmount> {
|
) -> Option<SignedAmount> {
|
||||||
let weight = satisfaction_weight.checked_add(TX_IN_BASE_WEIGHT)?;
|
let weight = satisfaction_weight.checked_add(TX_IN_BASE_WEIGHT)?;
|
||||||
let signed_input_fee = fee_rate.checked_mul_by_weight(weight)?.to_signed();
|
let signed_input_fee = fee_rate.to_fee(weight)?.to_signed();
|
||||||
value.to_signed().checked_sub(signed_input_fee)
|
value.to_signed().checked_sub(signed_input_fee)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue