Skip to content

Commit 8602b77

Browse files
committed
new_with_sync_store ctor
1 parent 90ab1ba commit 8602b77

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lightning/src/util/sweep.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,30 @@ where
397397
}
398398
}
399399

400+
/// Constructs a new [`OutputSweeper`] with a synchronous [`KVStoreSync`].
401+
pub fn new_with_sync_store<KS: Deref>(
402+
best_block: BestBlock, broadcaster: B, fee_estimator: E, chain_data_source: Option<F>,
403+
output_spender: O, change_destination_source: D, kv_store: KS, logger: L,
404+
) -> OutputSweeper<B, D, E, F, KVStoreSyncWrapper<KS>, L, O>
405+
where
406+
KS::Target: KVStoreSync,
407+
{
408+
let kv_store = KVStoreSyncWrapper(kv_store);
409+
let outputs = Vec::new();
410+
let sweeper_state = Mutex::new(SweeperState { outputs, best_block, dirty: false });
411+
OutputSweeper::<B, D, E, F, KVStoreSyncWrapper<KS>, L, O> {
412+
sweeper_state,
413+
pending_sweep: AtomicBool::new(false),
414+
broadcaster,
415+
fee_estimator,
416+
chain_data_source,
417+
output_spender,
418+
change_destination_source,
419+
kv_store,
420+
logger,
421+
}
422+
}
423+
400424
/// Tells the sweeper to track the given outputs descriptors.
401425
///
402426
/// Usually, this should be called based on the values emitted by the

0 commit comments

Comments
 (0)