X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FBackgroundProcessor.java;h=cb7674ab79d603e48ba555ad1ab6926fcddf9b6c;hb=07d5d868dfe064aadb28a7f7ca6002c16be9723d;hp=fbb0a917919fe07dd2955a3e3c92cdf63ed746ec;hpb=384d4ce1dd44cbd9d7d09cf6ff7818ba0c3ac29b;p=ldk-java diff --git a/src/main/java/org/ldk/structs/BackgroundProcessor.java b/src/main/java/org/ldk/structs/BackgroundProcessor.java index fbb0a917..cb7674ab 100644 --- a/src/main/java/org/ldk/structs/BackgroundProcessor.java +++ b/src/main/java/org/ldk/structs/BackgroundProcessor.java @@ -16,10 +16,10 @@ import javax.annotation.Nullable; * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so, * writing it to disk/backups by invoking the callback given to it at startup. * [`ChannelManager`] persistence should be done in the background. - * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`] - * at the appropriate intervals. - * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`] - * is provided to [`BackgroundProcessor::start`]). + * Calling [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`] + * and [`PeerManager::timer_tick_occurred`] at the appropriate intervals. + * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a + * [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]). * * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied * upon as doing so may result in high latency. @@ -32,7 +32,9 @@ import javax.annotation.Nullable; * unilateral chain closure fees are at risk. * * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor - * [`Event`]: lightning::util::events::Event + * [`Event`]: lightning::events::Event + * [`PeerManager::timer_tick_occurred`]: lightning::ln::peer_handler::PeerManager::timer_tick_occurred + * [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events * BackgroundProcessor will immediately stop on drop. It should be stored until shutdown. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays @@ -90,8 +92,8 @@ public class BackgroundProcessor extends CommonBase { * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable */ - public static BackgroundProcessor start(Persister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, GossipSync gossip_sync, PeerManager peer_manager, Logger logger, Option_WriteableScoreZ scorer) { - long ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, channel_manager == null ? 0 : channel_manager.ptr, gossip_sync.ptr, peer_manager == null ? 0 : peer_manager.ptr, logger == null ? 0 : logger.ptr, scorer.ptr); + public static BackgroundProcessor start(org.ldk.structs.Persister persister, org.ldk.structs.EventHandler event_handler, org.ldk.structs.ChainMonitor chain_monitor, org.ldk.structs.ChannelManager channel_manager, org.ldk.structs.GossipSync gossip_sync, org.ldk.structs.PeerManager peer_manager, org.ldk.structs.Logger logger, org.ldk.structs.Option_WriteableScoreZ scorer) { + long ret = bindings.BackgroundProcessor_start(persister.ptr, event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, channel_manager == null ? 0 : channel_manager.ptr, gossip_sync.ptr, peer_manager == null ? 0 : peer_manager.ptr, logger.ptr, scorer.ptr); Reference.reachabilityFence(persister); Reference.reachabilityFence(event_handler); Reference.reachabilityFence(chain_monitor); @@ -107,6 +109,7 @@ public class BackgroundProcessor extends CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(event_handler); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(chain_monitor); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(gossip_sync); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(peer_manager); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); }; @@ -124,11 +127,11 @@ public class BackgroundProcessor extends CommonBase { * * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ - public Result_NoneErrorZ join() { + public Result_NoneIOErrorZ join() { long ret = bindings.BackgroundProcessor_join(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); + Result_NoneIOErrorZ ret_hu_conv = Result_NoneIOErrorZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(this); }; // Due to rust's strict-ownership memory model, in some cases we need to "move" // an object to pass exclusive ownership to the function being called. @@ -152,11 +155,11 @@ public class BackgroundProcessor extends CommonBase { * * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ - public Result_NoneErrorZ stop() { + public Result_NoneIOErrorZ stop() { long ret = bindings.BackgroundProcessor_stop(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); + Result_NoneIOErrorZ ret_hu_conv = Result_NoneIOErrorZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(this); }; // Due to rust's strict-ownership memory model, in some cases we need to "move" // an object to pass exclusive ownership to the function being called.