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 intermediate node, its outbound channel, and relay parameters.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ForwardNode extends CommonBase {
16 ForwardNode(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.ForwardNode_free(ptr); }
24 * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also
25 * used for [`BlindedPayInfo`] construction.
27 public ForwardTlvs get_tlvs() {
28 long ret = bindings.ForwardNode_get_tlvs(this.ptr);
29 Reference.reachabilityFence(this);
30 if (ret >= 0 && ret <= 4096) { return null; }
31 org.ldk.structs.ForwardTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ForwardTlvs(null, ret); }
32 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
37 * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also
38 * used for [`BlindedPayInfo`] construction.
40 public void set_tlvs(org.ldk.structs.ForwardTlvs val) {
41 bindings.ForwardNode_set_tlvs(this.ptr, val == null ? 0 : val.ptr);
42 Reference.reachabilityFence(this);
43 Reference.reachabilityFence(val);
44 if (this != null) { this.ptrs_to.add(val); };
50 public byte[] get_node_id() {
51 byte[] ret = bindings.ForwardNode_get_node_id(this.ptr);
52 Reference.reachabilityFence(this);
59 public void set_node_id(byte[] val) {
60 bindings.ForwardNode_set_node_id(this.ptr, InternalUtils.check_arr_len(val, 33));
61 Reference.reachabilityFence(this);
62 Reference.reachabilityFence(val);
66 * The maximum value, in msat, that may be accepted by this node.
68 public long get_htlc_maximum_msat() {
69 long ret = bindings.ForwardNode_get_htlc_maximum_msat(this.ptr);
70 Reference.reachabilityFence(this);
75 * The maximum value, in msat, that may be accepted by this node.
77 public void set_htlc_maximum_msat(long val) {
78 bindings.ForwardNode_set_htlc_maximum_msat(this.ptr, val);
79 Reference.reachabilityFence(this);
80 Reference.reachabilityFence(val);
84 * Constructs a new ForwardNode given each field
86 public static ForwardNode of(org.ldk.structs.ForwardTlvs tlvs_arg, byte[] node_id_arg, long htlc_maximum_msat_arg) {
87 long ret = bindings.ForwardNode_new(tlvs_arg == null ? 0 : tlvs_arg.ptr, InternalUtils.check_arr_len(node_id_arg, 33), htlc_maximum_msat_arg);
88 Reference.reachabilityFence(tlvs_arg);
89 Reference.reachabilityFence(node_id_arg);
90 Reference.reachabilityFence(htlc_maximum_msat_arg);
91 if (ret >= 0 && ret <= 4096) { return null; }
92 org.ldk.structs.ForwardNode ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ForwardNode(null, ret); }
93 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
94 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(tlvs_arg); };
99 long ret = bindings.ForwardNode_clone_ptr(this.ptr);
100 Reference.reachabilityFence(this);
105 * Creates a copy of the ForwardNode
107 public ForwardNode clone() {
108 long ret = bindings.ForwardNode_clone(this.ptr);
109 Reference.reachabilityFence(this);
110 if (ret >= 0 && ret <= 4096) { return null; }
111 org.ldk.structs.ForwardNode ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ForwardNode(null, ret); }
112 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };