1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * An update generated by the underlying Channel itself which contains some new information the
12 * ChannelMonitor should be made aware of.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelMonitorUpdate extends CommonBase {
16 ChannelMonitorUpdate(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.ChannelMonitorUpdate_free(ptr); }
24 * The sequence number of this update. Updates *must* be replayed in-order according to this
25 * sequence number (and updates may panic if they are not). The update_id values are strictly
26 * increasing and increase by one for each new update, with one exception specified below.
28 * This sequence number is also used to track up to which points updates which returned
29 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
30 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
32 * The only instance where update_id values are not strictly increasing is the case where we
33 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
34 * its docs for more details.
36 public long get_update_id() {
37 long ret = bindings.ChannelMonitorUpdate_get_update_id(this.ptr);
42 * The sequence number of this update. Updates *must* be replayed in-order according to this
43 * sequence number (and updates may panic if they are not). The update_id values are strictly
44 * increasing and increase by one for each new update, with one exception specified below.
46 * This sequence number is also used to track up to which points updates which returned
47 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
48 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
50 * The only instance where update_id values are not strictly increasing is the case where we
51 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
52 * its docs for more details.
54 public void set_update_id(long val) {
55 bindings.ChannelMonitorUpdate_set_update_id(this.ptr, val);
59 * Creates a copy of the ChannelMonitorUpdate
61 public ChannelMonitorUpdate clone() {
62 long ret = bindings.ChannelMonitorUpdate_clone(this.ptr);
63 if (ret < 1024) { return null; }
64 ChannelMonitorUpdate ret_hu_conv = new ChannelMonitorUpdate(null, ret);
65 ret_hu_conv.ptrs_to.add(this);
70 * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
72 public byte[] write() {
73 byte[] ret = bindings.ChannelMonitorUpdate_write(this.ptr);
78 * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
80 public static Result_ChannelMonitorUpdateDecodeErrorZ read(byte[] ser) {
81 long ret = bindings.ChannelMonitorUpdate_read(ser);
82 if (ret < 1024) { return null; }
83 Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret);