Skip to content

Commit d1827fd

Browse files
committed
f Account for new ConfirmationTargets
1 parent 458d31b commit d1827fd

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

src/event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ where
287287
} => {
288288
// Construct the raw transaction with the output that is paid the amount of the
289289
// channel.
290-
let confirmation_target = ConfirmationTarget::Normal;
290+
let confirmation_target = ConfirmationTarget::NonAnchorChannelFee;
291291

292292
// We set nLockTime to the current height to discourage fee sniping.
293293
let cur_height = self.channel_manager.current_best_block().height();
@@ -582,7 +582,7 @@ where
582582

583583
let output_descriptors = &outputs.iter().collect::<Vec<_>>();
584584
let tx_feerate =
585-
self.wallet.get_est_sat_per_1000_weight(ConfirmationTarget::Normal);
585+
self.wallet.get_est_sat_per_1000_weight(ConfirmationTarget::OnChainSweep);
586586

587587
// We set nLockTime to the current height to discourage fee sniping.
588588
let cur_height = self.channel_manager.current_best_block().height();

src/wallet.rs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,23 @@ where
116116
let mut locked_fee_rate_cache = self.fee_rate_cache.write().unwrap();
117117

118118
let confirmation_targets = vec![
119-
ConfirmationTarget::MempoolMinimum,
120-
ConfirmationTarget::Background,
121-
ConfirmationTarget::Normal,
122-
ConfirmationTarget::HighPriority,
119+
ConfirmationTarget::OnChainSweep,
120+
ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee,
121+
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee,
122+
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee,
123+
ConfirmationTarget::AnchorChannelFee,
124+
ConfirmationTarget::NonAnchorChannelFee,
125+
ConfirmationTarget::ChannelCloseMinimum,
123126
];
124127
for target in confirmation_targets {
125128
let num_blocks = match target {
126-
ConfirmationTarget::MempoolMinimum => 1008,
127-
ConfirmationTarget::Background => 12,
128-
ConfirmationTarget::Normal => 6,
129-
ConfirmationTarget::HighPriority => 3,
129+
ConfirmationTarget::OnChainSweep => 3,
130+
ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => 1,
131+
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => 1008,
132+
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => 12,
133+
ConfirmationTarget::AnchorChannelFee => 12,
134+
ConfirmationTarget::NonAnchorChannelFee => 6,
135+
ConfirmationTarget::ChannelCloseMinimum => 12,
130136
};
131137

132138
let est_fee_rate = self.blockchain.estimate_fee(num_blocks).await;
@@ -211,7 +217,7 @@ where
211217
pub(crate) fn send_to_address(
212218
&self, address: &bitcoin::Address, amount_msat_or_drain: Option<u64>,
213219
) -> Result<Txid, Error> {
214-
let confirmation_target = ConfirmationTarget::Normal;
220+
let confirmation_target = ConfirmationTarget::NonAnchorChannelFee;
215221
let fee_rate = self.estimate_fee_rate(confirmation_target);
216222

217223
let tx = {
@@ -284,10 +290,13 @@ where
284290
let locked_fee_rate_cache = self.fee_rate_cache.read().unwrap();
285291

286292
let fallback_sats_kwu = match confirmation_target {
287-
ConfirmationTarget::MempoolMinimum => FEERATE_FLOOR_SATS_PER_KW,
288-
ConfirmationTarget::Background => 500,
289-
ConfirmationTarget::Normal => 2000,
290-
ConfirmationTarget::HighPriority => 5000,
293+
ConfirmationTarget::OnChainSweep => 5000,
294+
ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => 25 * 250,
295+
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => FEERATE_FLOOR_SATS_PER_KW,
296+
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => FEERATE_FLOOR_SATS_PER_KW,
297+
ConfirmationTarget::AnchorChannelFee => 500,
298+
ConfirmationTarget::NonAnchorChannelFee => 1000,
299+
ConfirmationTarget::ChannelCloseMinimum => 500,
291300
};
292301

293302
// We'll fall back on this, if we really don't have any other information.

0 commit comments

Comments
 (0)