[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / BlindedForward.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  * Information used to forward or fail this HTLC that is being forwarded within a blinded path.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class BlindedForward extends CommonBase {
16         BlindedForward(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.BlindedForward_free(ptr); }
21         }
22
23         /**
24          * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound
25          * onion payload if we're the introduction node. Useful for calculating the next hop's
26          * [`msgs::UpdateAddHTLC::blinding_point`].
27          */
28         public byte[] get_inbound_blinding_point() {
29                 byte[] ret = bindings.BlindedForward_get_inbound_blinding_point(this.ptr);
30                 Reference.reachabilityFence(this);
31                 return ret;
32         }
33
34         /**
35          * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound
36          * onion payload if we're the introduction node. Useful for calculating the next hop's
37          * [`msgs::UpdateAddHTLC::blinding_point`].
38          */
39         public void set_inbound_blinding_point(byte[] val) {
40                 bindings.BlindedForward_set_inbound_blinding_point(this.ptr, InternalUtils.check_arr_len(val, 33));
41                 Reference.reachabilityFence(this);
42                 Reference.reachabilityFence(val);
43         }
44
45         /**
46          * If needed, this determines how this HTLC should be failed backwards, based on whether we are
47          * the introduction node.
48          */
49         public BlindedFailure get_failure() {
50                 BlindedFailure ret = bindings.BlindedForward_get_failure(this.ptr);
51                 Reference.reachabilityFence(this);
52                 return ret;
53         }
54
55         /**
56          * If needed, this determines how this HTLC should be failed backwards, based on whether we are
57          * the introduction node.
58          */
59         public void set_failure(org.ldk.enums.BlindedFailure val) {
60                 bindings.BlindedForward_set_failure(this.ptr, val);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(val);
63         }
64
65         /**
66          * Constructs a new BlindedForward given each field
67          */
68         public static BlindedForward of(byte[] inbound_blinding_point_arg, org.ldk.enums.BlindedFailure failure_arg) {
69                 long ret = bindings.BlindedForward_new(InternalUtils.check_arr_len(inbound_blinding_point_arg, 33), failure_arg);
70                 Reference.reachabilityFence(inbound_blinding_point_arg);
71                 Reference.reachabilityFence(failure_arg);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.BlindedForward ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedForward(null, ret); }
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
75                 return ret_hu_conv;
76         }
77
78         long clone_ptr() {
79                 long ret = bindings.BlindedForward_clone_ptr(this.ptr);
80                 Reference.reachabilityFence(this);
81                 return ret;
82         }
83
84         /**
85          * Creates a copy of the BlindedForward
86          */
87         public BlindedForward clone() {
88                 long ret = bindings.BlindedForward_clone(this.ptr);
89                 Reference.reachabilityFence(this);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 org.ldk.structs.BlindedForward ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedForward(null, ret); }
92                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
93                 return ret_hu_conv;
94         }
95
96         /**
97          * Generates a non-cryptographic 64-bit hash of the BlindedForward.
98          */
99         public long hash() {
100                 long ret = bindings.BlindedForward_hash(this.ptr);
101                 Reference.reachabilityFence(this);
102                 return ret;
103         }
104
105         @Override public int hashCode() {
106                 return (int)this.hash();
107         }
108         /**
109          * Checks if two BlindedForwards contain equal inner contents.
110          * This ignores pointers and is_owned flags and looks at the values in fields.
111          * Two objects with NULL inner values will be considered "equal" here.
112          */
113         public boolean eq(org.ldk.structs.BlindedForward b) {
114                 boolean ret = bindings.BlindedForward_eq(this.ptr, b == null ? 0 : b.ptr);
115                 Reference.reachabilityFence(this);
116                 Reference.reachabilityFence(b);
117                 if (this != null) { this.ptrs_to.add(b); };
118                 return ret;
119         }
120
121         @Override public boolean equals(Object o) {
122                 if (!(o instanceof BlindedForward)) return false;
123                 return this.eq((BlindedForward)o);
124         }
125         /**
126          * Serialize the BlindedForward object into a byte array which can be read by BlindedForward_read
127          */
128         public byte[] write() {
129                 byte[] ret = bindings.BlindedForward_write(this.ptr);
130                 Reference.reachabilityFence(this);
131                 return ret;
132         }
133
134         /**
135          * Read a BlindedForward from a byte array, created by BlindedForward_write
136          */
137         public static Result_BlindedForwardDecodeErrorZ read(byte[] ser) {
138                 long ret = bindings.BlindedForward_read(ser);
139                 Reference.reachabilityFence(ser);
140                 if (ret >= 0 && ret <= 4096) { return null; }
141                 Result_BlindedForwardDecodeErrorZ ret_hu_conv = Result_BlindedForwardDecodeErrorZ.constr_from_ptr(ret);
142                 return ret_hu_conv;
143         }
144
145 }