Repository: rust-bitcoin/rust-bitcoin (language: rust)

Issue:
New Mutants Found
Displaying up to the first 10 mutants:

units/src/fee.rs:129:61: replace FeeRate::fee_wu -> Option<Amount> with None
units/src/fee.rs:129:61: replace FeeRate::fee_wu -> Option<Amount> with Some(Default::default())
units/src/fee.rs:139:9: replace FeeRate::fee_vb -> Option<Amount> with None
units/src/fee.rs:139:9: replace FeeRate::fee_vb -> Option<Amount> with Some(Default::default())
units/src/fee.rs:214:9: replace Weight::checked_mul_by_fee_rate -> Option<Amount> with None

For the complete list, please check the [mutants.out artifact](https://github.com/rust-bitcoin/rust-bitcoin/actions/runs/13221225992).


Discussion / hints:
Mad! Nice work @shinghim 
Glad to see that it's working!

Fix patch:
diff --git a/.cargo/mutants.toml b/.cargo/mutants.toml
index 6477f498e..96f373550 100644
--- a/.cargo/mutants.toml
+++ b/.cargo/mutants.toml
@@ -19,6 +19,8 @@ exclude_re = [
     "dec_width", # Replacing num /= 10 with num %=10 in a loop causes a timeout due to infinite loop
     # src/locktime/relative.rs
     "Time::to_consensus_u32", # Mutant from replacing | with ^, this returns the same value since the XOR is taken against the u16 with an all-zero bitmask
+    "FeeRate::fee_vb", # Deprecated
+    "FeeRate::fee_wu", # Deprecated
 
     # primitives
     "Sequence::from_512_second_intervals", # Mutant from replacing | with ^, this returns the same value since the XOR is taken against the u16 with an all-zero bitmask
diff --git a/units/src/fee.rs b/units/src/fee.rs
index 94601db87..84c0899b8 100644
--- a/units/src/fee.rs
+++ b/units/src/fee.rs
@@ -254,7 +254,7 @@ mod tests {
 
         let weight = Weight::from_wu(381);
         let fee_rate = FeeRate::from_sat_per_kwu(864);
-        let fee = fee_rate.checked_mul_by_weight(weight).unwrap();
+        let fee = weight.checked_mul_by_fee_rate(fee_rate).unwrap();
         // 381 * 0.864 yields 329.18.
         // The result is then rounded up to 330.
         assert_eq!(fee, Amount::from_sat_unchecked(330));


Test patch: