X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-transaction-sync%2Fsrc%2Fesplora.rs;h=82c49b9f9d2e8dfda23ea941ae41f5d5e3ebf943;hb=777ce7b059c0e81cbb36813d9ad028f767985fdd;hp=538918ada953f74e8170864be1a20f7a6e3bf7ad;hpb=b71c6e2f6701f0e0f1b4c92db00772edbc4d262d;p=rust-lightning diff --git a/lightning-transaction-sync/src/esplora.rs b/lightning-transaction-sync/src/esplora.rs index 538918ad..82c49b9f 100644 --- a/lightning-transaction-sync/src/esplora.rs +++ b/lightning-transaction-sync/src/esplora.rs @@ -51,7 +51,7 @@ where pub fn new(server_url: String, logger: L) -> Self { let builder = Builder::new(&server_url); #[cfg(not(feature = "async-interface"))] - let client = builder.build_blocking().unwrap(); + let client = builder.build_blocking(); #[cfg(feature = "async-interface")] let client = builder.build_async().unwrap(); @@ -59,6 +59,8 @@ where } /// Returns a new [`EsploraSyncClient`] object using the given Esplora client. + /// + /// This is not exported to bindings users as the underlying client from BDK is not exported. pub fn from_client(client: EsploraClientType, logger: L) -> Self { let sync_state = MutexType::new(SyncState::new()); let queue = std::sync::Mutex::new(FilterQueue::new()); @@ -82,7 +84,9 @@ where /// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager /// [`Filter`]: lightning::chain::Filter #[maybe_async] - pub fn sync(&self, confirmables: Vec<&(dyn Confirm + Sync + Send)>) -> Result<(), TxSyncError> { + pub fn sync(&self, confirmables: Vec) -> Result<(), TxSyncError> + where C::Target: Confirm + { // This lock makes sure we're syncing once at a time. #[cfg(not(feature = "async-interface"))] let mut sync_state = self.sync_state.lock().unwrap(); @@ -237,10 +241,11 @@ where } #[maybe_async] - fn sync_best_block_updated( - &self, confirmables: &Vec<&(dyn Confirm + Sync + Send)>, sync_state: &mut SyncState, tip_hash: &BlockHash, - ) -> Result<(), InternalError> { - + fn sync_best_block_updated( + &self, confirmables: &Vec, sync_state: &mut SyncState, tip_hash: &BlockHash, + ) -> Result<(), InternalError> + where C::Target: Confirm + { // Inform the interface of the new block. let tip_header = maybe_await!(self.client.get_header_by_hash(tip_hash))?; let tip_status = maybe_await!(self.client.get_block_status(&tip_hash))?; @@ -367,9 +372,11 @@ where } #[maybe_async] - fn get_unconfirmed_transactions( - &self, confirmables: &Vec<&(dyn Confirm + Sync + Send)>, - ) -> Result, InternalError> { + fn get_unconfirmed_transactions( + &self, confirmables: &Vec, + ) -> Result, 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 @@ -397,6 +404,8 @@ where } /// Returns a reference to the underlying esplora client. + /// + /// This is not exported to bindings users as the underlying client from BDK is not exported. pub fn client(&self) -> &EsploraClientType { &self.client }