X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Fchain%2Fchaininterface.rs;h=bd628703992bb45184f0d1f85395828b78ff8544;hb=036da10cc98c0d3ca093a58a9cd9f20dcba832c7;hp=17cff8bb34ad124795820988422695697a41c876;hpb=9e34ca7e68bc8caca0b76f29efbac903ce5b9d2b;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/chain/chaininterface.rs b/lightning-c-bindings/src/lightning/chain/chaininterface.rs index 17cff8b..bd62870 100644 --- a/lightning-c-bindings/src/lightning/chain/chaininterface.rs +++ b/lightning-c-bindings/src/lightning/chain/chaininterface.rs @@ -29,6 +29,16 @@ 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 Send for BroadcasterInterface {} +unsafe impl Sync for BroadcasterInterface {} +#[no_mangle] +pub(crate) extern "C" fn BroadcasterInterface_clone_fields(orig: &BroadcasterInterface) -> BroadcasterInterface { + BroadcasterInterface { + this_arg: orig.this_arg, + broadcast_transaction: Clone::clone(&orig.broadcast_transaction), + free: Clone::clone(&orig.free), + } +} use lightning::chain::chaininterface::BroadcasterInterface as rustBroadcasterInterface; impl rustBroadcasterInterface for BroadcasterInterface { @@ -108,6 +118,24 @@ impl ConfirmationTarget { pub extern "C" fn ConfirmationTarget_clone(orig: &ConfirmationTarget) -> ConfirmationTarget { orig.clone() } +#[no_mangle] +/// Utility method to constructs a new Background-variant ConfirmationTarget +pub extern "C" fn ConfirmationTarget_background() -> ConfirmationTarget { + ConfirmationTarget::Background} +#[no_mangle] +/// Utility method to constructs a new Normal-variant ConfirmationTarget +pub extern "C" fn ConfirmationTarget_normal() -> ConfirmationTarget { + ConfirmationTarget::Normal} +#[no_mangle] +/// Utility method to constructs a new HighPriority-variant ConfirmationTarget +pub extern "C" fn ConfirmationTarget_high_priority() -> ConfirmationTarget { + ConfirmationTarget::HighPriority} +/// Checks if two ConfirmationTargets contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn ConfirmationTarget_eq(a: &ConfirmationTarget, b: &ConfirmationTarget) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} /// A trait which should be implemented to provide feerate information on a number of time /// horizons. /// @@ -132,6 +160,16 @@ 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 Send for FeeEstimator {} +unsafe impl Sync for FeeEstimator {} +#[no_mangle] +pub(crate) extern "C" fn FeeEstimator_clone_fields(orig: &FeeEstimator) -> FeeEstimator { + FeeEstimator { + this_arg: orig.this_arg, + get_est_sat_per_1000_weight: Clone::clone(&orig.get_est_sat_per_1000_weight), + free: Clone::clone(&orig.free), + } +} use lightning::chain::chaininterface::FeeEstimator as rustFeeEstimator; impl rustFeeEstimator for FeeEstimator {