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