Skip to content

Commit 72b0b03

Browse files
committed
f Drop SpendingDelay enum
1 parent e0607bb commit 72b0b03

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lightning/src/util/sweep.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use bitcoin::blockdata::locktime::absolute::LockTime;
3030
use bitcoin::secp256k1::Secp256k1;
3131
use bitcoin::{BlockHash, Transaction, Txid};
3232

33-
use core::cmp;
3433
use core::ops::Deref;
3534

3635
/// The state of a spendable output currently tracked by an [`OutputSweeper`].
@@ -395,13 +394,13 @@ where
395394
/// [`SpendableOutputDescriptor::StaticOutput`]s, which may be handled directly by the on-chain
396395
/// wallet implementation.
397396
///
398-
/// If `delay_spend` is configured, we will delay the spending until the respective block
397+
/// If `delay_until_height` is set, we will delay the spending until the respective block
399398
/// height is reached. This can be used to batch spends, e.g., to reduce on-chain fees.
400399
///
401400
/// [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs
402401
pub fn track_spendable_outputs(
403402
&self, output_descriptors: Vec<SpendableOutputDescriptor>, channel_id: Option<ChannelId>,
404-
exclude_static_ouputs: bool, delay_spend: Option<SpendingDelay>,
403+
exclude_static_ouputs: bool, delay_until_height: Option<u32>,
405404
) {
406405
let mut relevant_descriptors = output_descriptors
407406
.into_iter()
@@ -418,16 +417,13 @@ where
418417
let mut spending_tx_opt;
419418
{
420419
let mut state_lock = self.sweeper_state.lock().unwrap();
421-
let cur_height = state_lock.best_block.height;
422-
let delayed_until_height = delay_spend.map(|delay| match delay {
423-
SpendingDelay::Relative { num_blocks } => cur_height + num_blocks,
424-
SpendingDelay::Absolute { height } => cmp::max(height, cur_height),
425-
});
426420
for descriptor in relevant_descriptors {
427421
let output_info = TrackedSpendableOutput {
428422
descriptor,
429423
channel_id,
430-
status: OutputSpendStatus::PendingInitialBroadcast { delayed_until_height },
424+
status: OutputSpendStatus::PendingInitialBroadcast {
425+
delayed_until_height: delay_until_height,
426+
},
431427
};
432428

433429
if state_lock

0 commit comments

Comments
 (0)