Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / ChannelMonitorUpdate.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9
10 /**
11  * An update generated by the underlying Channel itself which contains some new information the
12  * ChannelMonitor should be made aware of.
13  */
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 {
19                 super.finalize();
20                 if (ptr != 0) { bindings.ChannelMonitorUpdate_free(ptr); }
21         }
22
23         /**
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.
27          * 
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.
31          * 
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.
35          */
36         public long get_update_id() {
37                 long ret = bindings.ChannelMonitorUpdate_get_update_id(this.ptr);
38                 return ret;
39         }
40
41         /**
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.
45          * 
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.
49          * 
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.
53          */
54         public void set_update_id(long val) {
55                 bindings.ChannelMonitorUpdate_set_update_id(this.ptr, val);
56         }
57
58         /**
59          * Creates a copy of the ChannelMonitorUpdate
60          */
61         public ChannelMonitorUpdate clone() {
62                 long ret = bindings.ChannelMonitorUpdate_clone(this.ptr);
63                 if (ret >= 0 && ret <= 4096) { return null; }
64                 ChannelMonitorUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelMonitorUpdate(null, ret); }
65                 ret_hu_conv.ptrs_to.add(this);
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
71          */
72         public byte[] write() {
73                 byte[] ret = bindings.ChannelMonitorUpdate_write(this.ptr);
74                 return ret;
75         }
76
77         /**
78          * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
79          */
80         public static Result_ChannelMonitorUpdateDecodeErrorZ read(byte[] ser) {
81                 long ret = bindings.ChannelMonitorUpdate_read(ser);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret);
84                 return ret_hu_conv;
85         }
86
87 }