From ee0486a43f33a6068f13fb1a82244ecb60b94740 Mon Sep 17 00:00:00 2001 From: yancy Date: Tue, 14 Jan 2025 12:29:46 -0600 Subject: [PATCH] refactor: use convenience method to calculate fee The FeeRate module provides a convenience method to calculate the fee. --- bitcoin/src/blockdata/transaction.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index 7d7bf7699..d9ec07c80 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -790,7 +790,7 @@ pub fn effective_value( value: Amount, ) -> Option { 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) }