1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * An update generated by the underlying Channel itself which contains some new information the
13 * ChannelMonitor should be made aware of.
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class ChannelMonitorUpdate extends CommonBase {
17 ChannelMonitorUpdate(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.ChannelMonitorUpdate_free(ptr); }
25 * The sequence number of this update. Updates *must* be replayed in-order according to this
26 * sequence number (and updates may panic if they are not). The update_id values are strictly
27 * increasing and increase by one for each new update, with one exception specified below.
29 * This sequence number is also used to track up to which points updates which returned
30 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
31 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
33 * The only instance where update_id values are not strictly increasing is the case where we
34 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
35 * its docs for more details.
37 public long get_update_id() {
38 long ret = bindings.ChannelMonitorUpdate_get_update_id(this.ptr);
39 Reference.reachabilityFence(this);
44 * The sequence number of this update. Updates *must* be replayed in-order according to this
45 * sequence number (and updates may panic if they are not). The update_id values are strictly
46 * increasing and increase by one for each new update, with one exception specified below.
48 * This sequence number is also used to track up to which points updates which returned
49 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
50 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
52 * The only instance where update_id values are not strictly increasing is the case where we
53 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
54 * its docs for more details.
56 public void set_update_id(long val) {
57 bindings.ChannelMonitorUpdate_set_update_id(this.ptr, val);
58 Reference.reachabilityFence(this);
59 Reference.reachabilityFence(val);
63 long ret = bindings.ChannelMonitorUpdate_clone_ptr(this.ptr);
64 Reference.reachabilityFence(this);
69 * Creates a copy of the ChannelMonitorUpdate
71 public ChannelMonitorUpdate clone() {
72 long ret = bindings.ChannelMonitorUpdate_clone(this.ptr);
73 Reference.reachabilityFence(this);
74 if (ret >= 0 && ret <= 4096) { return null; }
75 ChannelMonitorUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelMonitorUpdate(null, ret); }
76 ret_hu_conv.ptrs_to.add(this);
81 * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
83 public byte[] write() {
84 byte[] ret = bindings.ChannelMonitorUpdate_write(this.ptr);
85 Reference.reachabilityFence(this);
90 * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
92 public static Result_ChannelMonitorUpdateDecodeErrorZ read(byte[] ser) {
93 long ret = bindings.ChannelMonitorUpdate_read(ser);
94 Reference.reachabilityFence(ser);
95 if (ret >= 0 && ret <= 4096) { return null; }
96 Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret);