]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Correct RBF bump rate calculation
authorMatt Corallo <git@bluematt.me>
Tue, 8 Oct 2024 20:03:21 +0000 (20:03 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 15 Oct 2024 15:43:40 +0000 (15:43 +0000)
Dating back to its introduction in
757bcc2951b6750d39ef1d841593be1e7f1c57cd, `get_height_timer` has
never used the `MIDDLE_FREQUENCY_BUMP_INTERVAL` (then not even a
constant) as its if tree was in the wrong order.

This fixes that.

lightning/src/chain/package.rs

index a5b94b56686555dd9de00623e9a0c0ea2481d72f..9983ad5e58aa4cfc70ffecd91a863ca559d9e886 100644 (file)
@@ -959,10 +959,10 @@ impl PackageTemplate {
        pub(crate) fn get_height_timer(&self, current_height: u32) -> u32 {
                let mut height_timer = current_height + LOW_FREQUENCY_BUMP_INTERVAL;
                let timer_for_target_conf = |target_conf| -> u32 {
-                       if target_conf <= current_height + MIDDLE_FREQUENCY_BUMP_INTERVAL {
-                               current_height + HIGH_FREQUENCY_BUMP_INTERVAL
-                       } else if target_conf <= current_height + LOW_FREQUENCY_BUMP_INTERVAL {
+                       if target_conf <= current_height + LOW_FREQUENCY_BUMP_INTERVAL {
                                current_height + MIDDLE_FREQUENCY_BUMP_INTERVAL
+                       } else if target_conf <= current_height + MIDDLE_FREQUENCY_BUMP_INTERVAL {
+                               current_height + HIGH_FREQUENCY_BUMP_INTERVAL
                        } else {
                                current_height + LOW_FREQUENCY_BUMP_INTERVAL
                        }