|
80 | 80 | ConfirmationTarget::HighPriority,
|
81 | 81 | ];
|
82 | 82 | for target in confirmation_targets {
|
83 |
| - let num_blocks = num_blocks_from_conf_target(target); |
| 83 | + let num_blocks = match target { |
| 84 | + ConfirmationTarget::Background => 12, |
| 85 | + ConfirmationTarget::Normal => 6, |
| 86 | + ConfirmationTarget::HighPriority => 3, |
| 87 | + }; |
84 | 88 |
|
85 | 89 | let est_fee_rate = self.blockchain.estimate_fee(num_blocks).await;
|
86 | 90 |
|
@@ -151,8 +155,14 @@ where
|
151 | 155 | fn estimate_fee_rate(&self, confirmation_target: ConfirmationTarget) -> FeeRate {
|
152 | 156 | let locked_fee_rate_cache = self.fee_rate_cache.read().unwrap();
|
153 | 157 |
|
| 158 | + let fallback_sats_kwu = match confirmation_target { |
| 159 | + ConfirmationTarget::Background => FEERATE_FLOOR_SATS_PER_KW, |
| 160 | + ConfirmationTarget::Normal => 2000, |
| 161 | + ConfirmationTarget::HighPriority => 5000, |
| 162 | + }; |
| 163 | + |
154 | 164 | // We'll fall back on this, if we really don't have any other information.
|
155 |
| - let fallback_rate = fallback_fee_from_conf_target(confirmation_target); |
| 165 | + let fallback_rate = FeeRate::from_sat_per_kwu(fallback_sats_kwu as f32); |
156 | 166 |
|
157 | 167 | *locked_fee_rate_cache.get(&confirmation_target).unwrap_or(&fallback_rate)
|
158 | 168 | }
|
@@ -194,21 +204,3 @@ where
|
194 | 204 | }
|
195 | 205 | }
|
196 | 206 | }
|
197 |
| - |
198 |
| -fn num_blocks_from_conf_target(confirmation_target: ConfirmationTarget) -> usize { |
199 |
| - match confirmation_target { |
200 |
| - ConfirmationTarget::Background => 12, |
201 |
| - ConfirmationTarget::Normal => 6, |
202 |
| - ConfirmationTarget::HighPriority => 3, |
203 |
| - } |
204 |
| -} |
205 |
| - |
206 |
| -fn fallback_fee_from_conf_target(confirmation_target: ConfirmationTarget) -> FeeRate { |
207 |
| - let sats_kwu = match confirmation_target { |
208 |
| - ConfirmationTarget::Background => FEERATE_FLOOR_SATS_PER_KW, |
209 |
| - ConfirmationTarget::Normal => 2000, |
210 |
| - ConfirmationTarget::HighPriority => 5000, |
211 |
| - }; |
212 |
| - |
213 |
| - FeeRate::from_sat_per_kwu(sats_kwu as f32) |
214 |
| -} |
0 commit comments