X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Fchain%2Fchaininterface.rs;h=17cff8bb34ad124795820988422695697a41c876;hp=9b8e84b105e22e160ebe75a1bb5bec63aa82bbbc;hb=1926a7a71ae0f37ebd6562996769334e0af0cf1b;hpb=d9866e870bbe080412dc70b1421e28a756e4407e diff --git a/lightning-c-bindings/src/lightning/chain/chaininterface.rs b/lightning-c-bindings/src/lightning/chain/chaininterface.rs index 9b8e84b..17cff8b 100644 --- a/lightning-c-bindings/src/lightning/chain/chaininterface.rs +++ b/lightning-c-bindings/src/lightning/chain/chaininterface.rs @@ -12,6 +12,7 @@ //! Includes traits for monitoring and receiving notifications of new blocks and block //! disconnections, transaction broadcasting, and feerate information requests. +use std::str::FromStr; use std::ffi::c_void; use bitcoin::hashes::Hash; use crate::c_types::*; @@ -28,14 +29,11 @@ pub struct BroadcasterInterface { /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } -unsafe impl Sync for BroadcasterInterface {} -unsafe impl Send for BroadcasterInterface {} use lightning::chain::chaininterface::BroadcasterInterface as rustBroadcasterInterface; impl rustBroadcasterInterface for BroadcasterInterface { - fn broadcast_transaction(&self, tx: &bitcoin::blockdata::transaction::Transaction) { - let mut local_tx = ::bitcoin::consensus::encode::serialize(tx); - (self.broadcast_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_tx)) + fn broadcast_transaction(&self, mut tx: &bitcoin::blockdata::transaction::Transaction) { + (self.broadcast_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(tx)) } } @@ -134,12 +132,10 @@ pub struct FeeEstimator { /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } -unsafe impl Sync for FeeEstimator {} -unsafe impl Send for FeeEstimator {} use lightning::chain::chaininterface::FeeEstimator as rustFeeEstimator; impl rustFeeEstimator for FeeEstimator { - fn get_est_sat_per_1000_weight(&self, confirmation_target: lightning::chain::chaininterface::ConfirmationTarget) -> u32 { + fn get_est_sat_per_1000_weight(&self, mut confirmation_target: lightning::chain::chaininterface::ConfirmationTarget) -> u32 { let mut ret = (self.get_est_sat_per_1000_weight)(self.this_arg, crate::lightning::chain::chaininterface::ConfirmationTarget::native_into(confirmation_target)); ret }