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_fail_htlc`] message to be sent to or received from a peer.
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
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 {
22 if (ptr != 0) { bindings.UpdateFailHTLC_free(ptr); }
28 public byte[] get_channel_id() {
29 byte[] ret = bindings.UpdateFailHTLC_get_channel_id(this.ptr);
30 Reference.reachabilityFence(this);
37 public void set_channel_id(byte[] val) {
38 bindings.UpdateFailHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39 Reference.reachabilityFence(this);
40 Reference.reachabilityFence(val);
46 public long get_htlc_id() {
47 long ret = bindings.UpdateFailHTLC_get_htlc_id(this.ptr);
48 Reference.reachabilityFence(this);
55 public void set_htlc_id(long val) {
56 bindings.UpdateFailHTLC_set_htlc_id(this.ptr, val);
57 Reference.reachabilityFence(this);
58 Reference.reachabilityFence(val);
62 long ret = bindings.UpdateFailHTLC_clone_ptr(this.ptr);
63 Reference.reachabilityFence(this);
68 * Creates a copy of the UpdateFailHTLC
70 public UpdateFailHTLC clone() {
71 long ret = bindings.UpdateFailHTLC_clone(this.ptr);
72 Reference.reachabilityFence(this);
73 if (ret >= 0 && ret <= 4096) { return null; }
74 org.ldk.structs.UpdateFailHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFailHTLC(null, ret); }
75 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
80 * Checks if two UpdateFailHTLCs contain equal inner contents.
81 * This ignores pointers and is_owned flags and looks at the values in fields.
82 * Two objects with NULL inner values will be considered "equal" here.
84 public boolean eq(org.ldk.structs.UpdateFailHTLC b) {
85 boolean ret = bindings.UpdateFailHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
86 Reference.reachabilityFence(this);
87 Reference.reachabilityFence(b);
88 if (this != null) { this.ptrs_to.add(b); };
92 @Override public boolean equals(Object o) {
93 if (!(o instanceof UpdateFailHTLC)) return false;
94 return this.eq((UpdateFailHTLC)o);
97 * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
99 public byte[] write() {
100 byte[] ret = bindings.UpdateFailHTLC_write(this.ptr);
101 Reference.reachabilityFence(this);
106 * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
108 public static Result_UpdateFailHTLCDecodeErrorZ read(byte[] ser) {
109 long ret = bindings.UpdateFailHTLC_read(ser);
110 Reference.reachabilityFence(ser);
111 if (ret >= 0 && ret <= 4096) { return null; }
112 Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret);