X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning_rapid_gossip_sync%2Fprocessing.rs;fp=lightning-c-bindings%2Fsrc%2Flightning_rapid_gossip_sync%2Fprocessing.rs;h=e952ffd4de84c82f12781758261c472b75d7c69a;hp=0000000000000000000000000000000000000000;hb=45ad3320df3768514d968c70fc4b6a9d50028050;hpb=c014ce6a2df808ffec747f9a327c7f97bb1e3d08 diff --git a/lightning-c-bindings/src/lightning_rapid_gossip_sync/processing.rs b/lightning-c-bindings/src/lightning_rapid_gossip_sync/processing.rs new file mode 100644 index 0000000..e952ffd --- /dev/null +++ b/lightning-c-bindings/src/lightning_rapid_gossip_sync/processing.rs @@ -0,0 +1,32 @@ +// 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. + +/// Core functionality of this crate + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +/// Update network graph from binary data. +/// Returns the last sync timestamp to be used the next time rapid sync data is queried. +/// +/// `network_graph`: network graph to be updated +/// +/// `update_data`: `&[u8]` binary stream that comprises the update data +#[must_use] +#[no_mangle] +pub extern "C" fn RapidGossipSync_update_network_graph(this_arg: &crate::lightning_rapid_gossip_sync::RapidGossipSync, mut update_data: crate::c_types::u8slice) -> crate::c_types::derived::CResult_u32GraphSyncErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_network_graph(update_data.to_slice()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_rapid_gossip_sync::error::GraphSyncError::native_into(e) }).into() }; + local_ret +} +