[C#] Run tests against release library in determinism CI run
[ldk-java] / src / main / java / org / ldk / structs / UpdateFailHTLC.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 java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * An [`update_fail_htlc`] message to be sent to or received from a peer.
13  * 
14  * [`update_fail_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class UpdateFailHTLC extends CommonBase {
18         UpdateFailHTLC(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.UpdateFailHTLC_free(ptr); }
23         }
24
25         /**
26          * The channel ID
27          */
28         public ChannelId get_channel_id() {
29                 long ret = bindings.UpdateFailHTLC_get_channel_id(this.ptr);
30                 Reference.reachabilityFence(this);
31                 if (ret >= 0 && ret <= 4096) { return null; }
32                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
33                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
34                 return ret_hu_conv;
35         }
36
37         /**
38          * The channel ID
39          */
40         public void set_channel_id(org.ldk.structs.ChannelId val) {
41                 bindings.UpdateFailHTLC_set_channel_id(this.ptr, val.ptr);
42                 Reference.reachabilityFence(this);
43                 Reference.reachabilityFence(val);
44                 if (this != null) { this.ptrs_to.add(val); };
45         }
46
47         /**
48          * The HTLC ID
49          */
50         public long get_htlc_id() {
51                 long ret = bindings.UpdateFailHTLC_get_htlc_id(this.ptr);
52                 Reference.reachabilityFence(this);
53                 return ret;
54         }
55
56         /**
57          * The HTLC ID
58          */
59         public void set_htlc_id(long val) {
60                 bindings.UpdateFailHTLC_set_htlc_id(this.ptr, val);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(val);
63         }
64
65         long clone_ptr() {
66                 long ret = bindings.UpdateFailHTLC_clone_ptr(this.ptr);
67                 Reference.reachabilityFence(this);
68                 return ret;
69         }
70
71         /**
72          * Creates a copy of the UpdateFailHTLC
73          */
74         public UpdateFailHTLC clone() {
75                 long ret = bindings.UpdateFailHTLC_clone(this.ptr);
76                 Reference.reachabilityFence(this);
77                 if (ret >= 0 && ret <= 4096) { return null; }
78                 org.ldk.structs.UpdateFailHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFailHTLC(null, ret); }
79                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
80                 return ret_hu_conv;
81         }
82
83         /**
84          * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC.
85          */
86         public long hash() {
87                 long ret = bindings.UpdateFailHTLC_hash(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         @Override public int hashCode() {
93                 return (int)this.hash();
94         }
95         /**
96          * Checks if two UpdateFailHTLCs contain equal inner contents.
97          * This ignores pointers and is_owned flags and looks at the values in fields.
98          * Two objects with NULL inner values will be considered "equal" here.
99          */
100         public boolean eq(org.ldk.structs.UpdateFailHTLC b) {
101                 boolean ret = bindings.UpdateFailHTLC_eq(this.ptr, b.ptr);
102                 Reference.reachabilityFence(this);
103                 Reference.reachabilityFence(b);
104                 if (this != null) { this.ptrs_to.add(b); };
105                 return ret;
106         }
107
108         @Override public boolean equals(Object o) {
109                 if (!(o instanceof UpdateFailHTLC)) return false;
110                 return this.eq((UpdateFailHTLC)o);
111         }
112         /**
113          * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
114          */
115         public byte[] write() {
116                 byte[] ret = bindings.UpdateFailHTLC_write(this.ptr);
117                 Reference.reachabilityFence(this);
118                 return ret;
119         }
120
121         /**
122          * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
123          */
124         public static Result_UpdateFailHTLCDecodeErrorZ read(byte[] ser) {
125                 long ret = bindings.UpdateFailHTLC_read(ser);
126                 Reference.reachabilityFence(ser);
127                 if (ret >= 0 && ret <= 4096) { return null; }
128                 Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret);
129                 return ret_hu_conv;
130         }
131
132 }