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=b1c180bbf5a130f10244807d809580345a363cce;hp=9ba2256e9b915b7ee25ef6a385a34b73ba6cb346;hb=dd5bf474af6c806b20c26f4f2b751f3226a94dfd;hpb=2f0c348c6fe505a736c3d015df6d6cd30032c912 diff --git a/lightning-c-bindings/src/lightning/chain/chaininterface.rs b/lightning-c-bindings/src/lightning/chain/chaininterface.rs index 9ba2256..b1c180b 100644 --- a/lightning-c-bindings/src/lightning/chain/chaininterface.rs +++ b/lightning-c-bindings/src/lightning/chain/chaininterface.rs @@ -14,6 +14,7 @@ use std::str::FromStr; use std::ffi::c_void; +use core::convert::Infallible; use bitcoin::hashes::Hash; use crate::c_types::*; @@ -130,6 +131,12 @@ pub extern "C" fn ConfirmationTarget_normal() -> ConfirmationTarget { /// 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. /// @@ -142,12 +149,12 @@ pub struct FeeEstimator { pub this_arg: *mut c_void, /// Gets estimated satoshis of fee required per 1000 Weight-Units. /// - /// Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs - /// don't put us below 1 satoshi-per-byte). + /// Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later + /// round-downs don't put us below 1 satoshi-per-byte). /// - /// This translates to: - /// * satoshis-per-byte * 250 - /// * ceil(satoshis-per-kbyte / 4) + /// This method can be implemented with the following unit conversions: + /// * max(satoshis-per-byte * 250, 253) + /// * max(satoshis-per-kbyte / 4, 253) #[must_use] pub get_est_sat_per_1000_weight: extern "C" fn (this_arg: *const c_void, confirmation_target: crate::lightning::chain::chaininterface::ConfirmationTarget) -> u32, /// Frees any resources associated with this object given its this_arg pointer.