Skip to content

Commit 9f1a02e

Browse files
committed
no secondary types
1 parent 370d677 commit 9f1a02e

File tree

3 files changed

+16
-28
lines changed

3 files changed

+16
-28
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use lightning::onion_message::messenger::AOnionMessenger;
3636
use lightning::routing::gossip::{NetworkGraph, P2PGossipSync};
3737
use lightning::routing::scoring::{ScoreUpdate, WriteableScore};
3838
use lightning::routing::utxo::UtxoLookup;
39-
use lightning::sign::{ChangeDestinationSource, OutputSpender};
39+
use lightning::sign::{ChangeDestinationSourceSync, ChangeDestinationSource, OutputSpender};
4040
use lightning::util::logger::Logger;
4141
use lightning::util::persist::{KVStore, Persister};
4242
use lightning::util::sweep::OutputSweeper;
@@ -946,7 +946,7 @@ impl BackgroundProcessor {
946946
PM: 'static + Deref + Send + Sync,
947947
S: 'static + Deref<Target = SC> + Send + Sync,
948948
SC: for<'b> WriteableScore<'b>,
949-
D: 'static + Deref + Send + Sync,
949+
D: 'static + Deref + Send + Sync + Sized,
950950
O: 'static + Deref + Send + Sync,
951951
K: 'static + Deref + Send + Sync,
952952
OS: 'static + Deref<Target = OutputSweeper<T, D, F, CF, K, L, O>> + Send + Sync,
@@ -967,7 +967,7 @@ impl BackgroundProcessor {
967967
OM::Target: AOnionMessenger + Send + Sync,
968968
PM::Target: APeerManager + Send + Sync,
969969
O::Target: 'static + OutputSpender + Send + Sync,
970-
D::Target: 'static + ChangeDestinationSource + Send + Sync,
970+
D::Target: 'static + ChangeDestinationSourceSync + Send + Sync + Sized,
971971
K::Target: 'static + KVStore + Send + Sync,
972972
{
973973
let stop_thread = Arc::new(AtomicBool::new(false));

lightning/src/sign/mod.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,19 +1005,9 @@ pub trait ChangeDestinationSourceSync {
10051005
fn get_change_destination_script(&self) -> Result<ScriptBuf, ()>;
10061006
}
10071007

1008-
/// A wrapper around [`ChangeDestinationSource`] to allow for async calls.
1009-
pub struct ChangeDestinationSourceSyncWrapper<T>(T) where T: ChangeDestinationSourceSync;
1010-
1011-
impl<T: ChangeDestinationSourceSync> ChangeDestinationSourceSyncWrapper<T> {
1012-
/// Creates a new [`ChangeDestinationSourceSyncWrapper`].
1013-
pub fn new(source: T) -> Self {
1014-
Self(source)
1015-
}
1016-
}
1017-
1018-
impl<T: ChangeDestinationSourceSync> ChangeDestinationSource for ChangeDestinationSourceSyncWrapper<T> {
1008+
impl<T: ChangeDestinationSourceSync> ChangeDestinationSource for T {
10191009
fn get_change_destination_script<'a>(&self) -> AsyncGetChangeDestinationScriptResult<'a, ScriptBuf> {
1020-
let script = self.0.get_change_destination_script();
1010+
let script = self.get_change_destination_script();
10211011
Box::pin(async move { script })
10221012
}
10231013
}

lightning/src/util/sweep.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::io;
1515
use crate::ln::msgs::DecodeError;
1616
use crate::ln::types::ChannelId;
1717
use crate::prelude::*;
18-
use crate::sign::{ChangeDestinationSource, ChangeDestinationSourceSync, ChangeDestinationSourceSyncWrapper, OutputSpender, SpendableOutputDescriptor};
18+
use crate::sign::{ChangeDestinationSource, ChangeDestinationSourceSync, OutputSpender, SpendableOutputDescriptor};
1919
use crate::sync::Mutex;
2020
use crate::util::logger::Logger;
2121
use crate::util::persist::{
@@ -357,7 +357,7 @@ where
357357
logger: L,
358358
}
359359

360-
pub struct OutputSweeperSync<B: Deref, D: Deref, E: Deref, F: Deref, K: Deref, L: Deref, O: Deref>
360+
/*pub struct OutputSweeperSync<B: Deref, D: Deref, E: Deref, F: Deref, K: Deref, L: Deref, O: Deref>
361361
where
362362
B::Target: BroadcasterInterface,
363363
D::Target: ChangeDestinationSource,
@@ -368,35 +368,33 @@ where
368368
O::Target: OutputSpender,
369369
{
370370
sweeper: OutputSweeper<B, D, E, F, K, L, O>,
371-
}
371+
}*/
372372

373-
impl<B: Deref, D: Deref, E: Deref, F: Deref, K: Deref, L: Deref, O: Deref>
374-
OutputSweeperSync<B, D, E, F, K, L, O>
373+
impl<B: Deref, D: Deref + Sized, E: Deref, F: Deref, K: Deref, L: Deref, O: Deref>
374+
OutputSweeper<B, D, E, F, K, L, O>
375375
where
376376
B::Target: BroadcasterInterface,
377-
D::Target: ChangeDestinationSource,
377+
D::Target: ChangeDestinationSourceSync + Sized,
378378
E::Target: FeeEstimator,
379379
F::Target: Filter + Sync + Send,
380380
K::Target: KVStore,
381381
L::Target: Logger,
382382
O::Target: OutputSpender,
383383
{
384-
fn new<DA: ChangeDestinationSourceSync>(
384+
fn new_sync(
385385
best_block: BestBlock, broadcaster: B, fee_estimator: E, chain_data_source: Option<F>,
386-
output_spender: O, change_destination_source: DA, kv_store: K, logger: L,
386+
output_spender: O, change_destination_source: D, kv_store: K, logger: L,
387387
) -> Self {
388-
let change_destination_source = Arc::new(ChangeDestinationSourceSyncWrapper::new(change_destination_source));
389388

390-
let sweeper = OutputSweeper::new(
389+
OutputSweeper::new(
391390
best_block, broadcaster, fee_estimator, chain_data_source, output_spender,
392391
change_destination_source, kv_store, logger,
393-
);
394-
Self { sweeper }
392+
)
395393
}
396394

397395
/// Regenerates and broadcasts the spending transaction for any outputs that are pending
398396
pub fn regenerate_and_broadcast_spend_if_necessary(&self) -> Result<(), ()> {
399-
let mut fut = Box::pin(self.sweeper.regenerate_and_broadcast_spend_if_necessary_async());
397+
let mut fut = Box::pin(self.regenerate_and_broadcast_spend_if_necessary_async());
400398
let mut waker = dummy_waker();
401399
let mut ctx = task::Context::from_waker(&mut waker);
402400
match fut.as_mut().poll(&mut ctx) {

0 commit comments

Comments
 (0)