`rustfmt`: Reformat `lightning-transaction-sync/src/common.rs`
[rust-lightning] / lightning-transaction-sync / src / electrum.rs
index 046f698d4a259e3b0eace68790e59cfe1d406eb7..4c809d40716f6c3e87cba1b0f80bbec9f047a4bd 100644 (file)
@@ -58,6 +58,8 @@ where
        }
 
        /// Returns a new [`ElectrumSyncClient`] object using the given Electrum client.
+       ///
+       /// This is not exported to bindings users as the underlying client from BDK is not exported.
        pub fn from_client(client: ElectrumClient, logger: L) -> Result<Self, TxSyncError> {
                let sync_state = Mutex::new(SyncState::new());
                let queue = Mutex::new(FilterQueue::new());
@@ -81,7 +83,9 @@ where
        /// [`ChainMonitor`]: lightning::chain::chainmonitor::ChainMonitor
        /// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
        /// [`Filter`]: lightning::chain::Filter
-       pub fn sync(&self, confirmables: Vec<&(dyn Confirm + Sync + Send)>) -> Result<(), TxSyncError> {
+       pub fn sync<C: Deref>(&self, confirmables: Vec<C>) -> Result<(), TxSyncError>
+               where C::Target: Confirm
+       {
                // This lock makes sure we're syncing once at a time.
                let mut sync_state = self.sync_state.lock().unwrap();
 
@@ -376,9 +380,11 @@ where
                Ok(confirmed_txs)
        }
 
-       fn get_unconfirmed_transactions(
-               &self, confirmables: &Vec<&(dyn Confirm + Sync + Send)>,
-       ) -> Result<Vec<Txid>, InternalError> {
+       fn get_unconfirmed_transactions<C: Deref>(
+               &self, confirmables: &Vec<C>,
+       ) -> Result<Vec<Txid>, InternalError>
+               where C::Target: Confirm
+       {
                // Query the interface for relevant txids and check whether the relevant blocks are still
                // in the best chain, mark them unconfirmed otherwise
                let relevant_txids = confirmables
@@ -450,6 +456,8 @@ where
        }
 
        /// Returns a reference to the underlying Electrum client.
+       ///
+       /// This is not exported to bindings users as the underlying client from BDK is not exported.
        pub fn client(&self) -> &ElectrumClient {
                &self.client
        }