File tree 1 file changed +2
-9
lines changed
1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -61,20 +61,13 @@ pub trait WeightedUtxo {
61
61
effective_value ( fee_rate, self . weight ( ) , self . value ( ) )
62
62
}
63
63
64
- /// Computes the fee to spend this `Utxo`.
65
- ///
66
- /// The fee is calculated as: fee rate * (satisfaction_weight + the base weight).
67
- fn calculate_fee ( & self , fee_rate : FeeRate ) -> Option < Amount > {
68
- fee_rate. checked_mul_by_weight ( self . weight ( ) )
69
- }
70
-
71
64
/// Computes how wastefull it is to spend this `Utxo`
72
65
///
73
66
/// The waste is the difference of the fee to spend this `Utxo` now compared with the expected
74
67
/// fee to spend in the future (long_term_fee_rate).
75
68
fn waste ( & self , fee_rate : FeeRate , long_term_fee_rate : FeeRate ) -> Option < SignedAmount > {
76
- let fee: SignedAmount = self . calculate_fee ( fee_rate ) ?. to_signed ( ) . ok ( ) ?;
77
- let lt_fee: SignedAmount = self . calculate_fee ( long_term_fee_rate ) ?. to_signed ( ) . ok ( ) ?;
69
+ let fee: SignedAmount = fee_rate . fee_wu ( self . weight ( ) ) ?. to_signed ( ) . ok ( ) ?;
70
+ let lt_fee: SignedAmount = long_term_fee_rate . fee_wu ( self . weight ( ) ) ?. to_signed ( ) . ok ( ) ?;
78
71
fee. checked_sub ( lt_fee)
79
72
}
80
73
}
You can’t perform that action at this time.
0 commit comments