X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Frouting%2Frouter.rs;h=4289511eac37de8517a438a18301f649149bbf33;hb=05fd5718232e2aa9581a51cdace2c0642ea533a5;hp=496781fae070a7beb8895222d18028451eebbde6;hpb=a132c4d7f8648278537854ae08a83d704853ed42;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/routing/router.rs b/lightning-c-bindings/src/routing/router.rs index 496781f..4289511 100644 --- a/lightning-c-bindings/src/routing/router.rs +++ b/lightning-c-bindings/src/routing/router.rs @@ -1,3 +1,11 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + //! The top-level routing/network map tracking logic lives here. //! //! You probably want to create a NetGraphMsgHandler and use that as your RoutingMessageHandler and then @@ -350,6 +358,47 @@ pub extern "C" fn RouteHint_get_cltv_expiry_delta(this_ptr: &RouteHint) -> u16 { pub extern "C" fn RouteHint_set_cltv_expiry_delta(this_ptr: &mut RouteHint, mut val: u16) { unsafe { &mut *this_ptr.inner }.cltv_expiry_delta = val; } +/// The minimum value, in msat, which must be relayed to the next hop. +#[no_mangle] +pub extern "C" fn RouteHint_get_htlc_minimum_msat(this_ptr: &RouteHint) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { { crate::c_types::derived::COption_u64Z::Some(inner_val.unwrap()) } }; + local_inner_val +} +/// The minimum value, in msat, which must be relayed to the next hop. +#[no_mangle] +pub extern "C" fn RouteHint_set_htlc_minimum_msat(this_ptr: &mut RouteHint, mut val: crate::c_types::derived::COption_u64Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = local_val; +} +/// The maximum value in msat available for routing with a single HTLC. +#[no_mangle] +pub extern "C" fn RouteHint_get_htlc_maximum_msat(this_ptr: &RouteHint) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_maximum_msat; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { { crate::c_types::derived::COption_u64Z::Some(inner_val.unwrap()) } }; + local_inner_val +} +/// The maximum value in msat available for routing with a single HTLC. +#[no_mangle] +pub extern "C" fn RouteHint_set_htlc_maximum_msat(this_ptr: &mut RouteHint, mut val: crate::c_types::derived::COption_u64Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *this_ptr.inner }.htlc_maximum_msat = local_val; +} +/// Constructs a new RouteHint given each field +#[must_use] +#[no_mangle] +pub extern "C" fn RouteHint_new(mut src_node_id_arg: crate::c_types::PublicKey, mut short_channel_id_arg: u64, mut fees_arg: crate::routing::network_graph::RoutingFees, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z) -> RouteHint { + let mut local_htlc_minimum_msat_arg = if htlc_minimum_msat_arg.is_some() { Some( { htlc_minimum_msat_arg.take() }) } else { None }; + let mut local_htlc_maximum_msat_arg = if htlc_maximum_msat_arg.is_some() { Some( { htlc_maximum_msat_arg.take() }) } else { None }; + RouteHint { inner: Box::into_raw(Box::new(nativeRouteHint { + src_node_id: src_node_id_arg.into_rust(), + short_channel_id: short_channel_id_arg, + fees: *unsafe { Box::from_raw(fees_arg.take_inner()) }, + cltv_expiry_delta: cltv_expiry_delta_arg, + htlc_minimum_msat: local_htlc_minimum_msat_arg, + htlc_maximum_msat: local_htlc_maximum_msat_arg, + })), is_owned: true } +} impl Clone for RouteHint { fn clone(&self) -> Self { Self {