From 8e2419ce4cf7756437294b48ad6f0da5aba6e119 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 8 Oct 2024 20:03:21 +0000 Subject: [PATCH] Correct RBF bump rate calculation 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightning/src/chain/package.rs b/lightning/src/chain/package.rs index a5b94b56686..9983ad5e58a 100644 --- a/lightning/src/chain/package.rs +++ b/lightning/src/chain/package.rs @@ -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 }