diff --git a/lightning/src/events/bump_transaction/mod.rs b/lightning/src/events/bump_transaction/mod.rs index c1a4384a28d..b89d2a7fc25 100644 --- a/lightning/src/events/bump_transaction/mod.rs +++ b/lightning/src/events/bump_transaction/mod.rs @@ -572,7 +572,7 @@ where } fn sign_psbt<'a>(&'a self, psbt: Psbt) -> AsyncResult<'a, Transaction> { - Box::pin(async move { self.source.sign_psbt(psbt).await }) + self.source.sign_psbt(psbt) } } diff --git a/lightning/src/events/bump_transaction/sync.rs b/lightning/src/events/bump_transaction/sync.rs index 1df2cb5fde5..7d407f4bb8d 100644 --- a/lightning/src/events/bump_transaction/sync.rs +++ b/lightning/src/events/bump_transaction/sync.rs @@ -17,7 +17,6 @@ use crate::chain::chaininterface::BroadcasterInterface; use crate::chain::ClaimId; use crate::prelude::*; use crate::sign::SignerProvider; -use crate::sync::Arc; use crate::util::async_poll::{dummy_waker, AsyncResult, MaybeSend, MaybeSync}; use crate::util::logger::Logger; @@ -43,6 +42,18 @@ pub(crate) struct WalletSourceSyncWrapper(T) where T::Target: WalletSourceSync; +// Implement `Deref` directly on WalletSourceSyncWrapper so that it can be used directly +// below, rather than via a wrapper. +impl Deref for WalletSourceSyncWrapper +where + T::Target: WalletSourceSync, +{ + type Target = Self; + fn deref(&self) -> &Self { + self + } +} + impl WalletSource for WalletSourceSyncWrapper where T::Target: WalletSourceSync, @@ -69,7 +80,7 @@ where W::Target: WalletSourceSync + MaybeSend, L::Target: Logger + MaybeSend, { - wallet: Wallet>, L>, + wallet: Wallet, L>, } impl WalletSync @@ -79,7 +90,7 @@ where { /// Constructs a new [`WalletSync`] instance. pub fn new(source: W, logger: L) -> Self { - Self { wallet: Wallet::new(Arc::new(WalletSourceSyncWrapper(source)), logger) } + Self { wallet: Wallet::new(WalletSourceSyncWrapper(source), logger) } } } @@ -140,6 +151,18 @@ struct CoinSelectionSourceSyncWrapper(T) where T::Target: CoinSelectionSourceSync; +// Implement `Deref` directly on CoinSelectionSourceSyncWrapper so that it can be used directly +// below, rather than via a wrapper. +impl Deref for CoinSelectionSourceSyncWrapper +where + T::Target: CoinSelectionSourceSync, +{ + type Target = Self; + fn deref(&self) -> &Self { + self + } +} + impl CoinSelectionSource for CoinSelectionSourceSyncWrapper where T::Target: CoinSelectionSourceSync, @@ -172,7 +195,7 @@ where L::Target: Logger, { bump_transaction_event_handler: - Arc>, SP, L>>, + BumpTransactionEventHandler, SP, L>, } impl BumpTransactionEventHandlerSync @@ -184,12 +207,12 @@ where { /// Constructs a new instance of [`BumpTransactionEventHandlerSync`]. pub fn new(broadcaster: B, utxo_source: C, signer_provider: SP, logger: L) -> Self { - let bump_transaction_event_handler = Arc::new(BumpTransactionEventHandler::new( + let bump_transaction_event_handler = BumpTransactionEventHandler::new( broadcaster, - Arc::new(CoinSelectionSourceSyncWrapper(utxo_source)), + CoinSelectionSourceSyncWrapper(utxo_source), signer_provider, logger, - )); + ); Self { bump_transaction_event_handler } }