6 namespace org { namespace ldk { namespace structs {
10 * A channel descriptor for a hop along a payment path.
12 * While this generally comes from BOLT 11's `r` field, this struct includes more fields than are
13 * available in BOLT 11. Thus, encoding and decoding this via `lightning-invoice` is lossy, as
14 * fields not supported in BOLT 11 will be stripped.
16 public class RouteHintHop : CommonBase {
17 internal RouteHintHop(object _dummy, long ptr) : base(ptr) { }
19 if (ptr != 0) { bindings.RouteHintHop_free(ptr); }
23 * The node_id of the non-target end of the route
25 public byte[] get_src_node_id() {
26 long ret = bindings.RouteHintHop_get_src_node_id(this.ptr);
28 if (ret >= 0 && ret <= 4096) { return null; }
29 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
34 * The node_id of the non-target end of the route
36 public void set_src_node_id(byte[] val) {
37 bindings.RouteHintHop_set_src_node_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
43 * The short_channel_id of this channel
45 public long get_short_channel_id() {
46 long ret = bindings.RouteHintHop_get_short_channel_id(this.ptr);
52 * The short_channel_id of this channel
54 public void set_short_channel_id(long val) {
55 bindings.RouteHintHop_set_short_channel_id(this.ptr, val);
61 * The fees which must be paid to use this channel
63 public RoutingFees get_fees() {
64 long ret = bindings.RouteHintHop_get_fees(this.ptr);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); }
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
73 * The fees which must be paid to use this channel
75 public void set_fees(org.ldk.structs.RoutingFees val) {
76 bindings.RouteHintHop_set_fees(this.ptr, val == null ? 0 : val.ptr);
79 if (this != null) { this.ptrs_to.AddLast(val); };
83 * The difference in CLTV values between this node and the next node.
85 public short get_cltv_expiry_delta() {
86 short ret = bindings.RouteHintHop_get_cltv_expiry_delta(this.ptr);
92 * The difference in CLTV values between this node and the next node.
94 public void set_cltv_expiry_delta(short val) {
95 bindings.RouteHintHop_set_cltv_expiry_delta(this.ptr, val);
101 * The minimum value, in msat, which must be relayed to the next hop.
103 public Option_u64Z get_htlc_minimum_msat() {
104 long ret = bindings.RouteHintHop_get_htlc_minimum_msat(this.ptr);
106 if (ret >= 0 && ret <= 4096) { return null; }
107 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
108 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
113 * The minimum value, in msat, which must be relayed to the next hop.
115 public void set_htlc_minimum_msat(org.ldk.structs.Option_u64Z val) {
116 bindings.RouteHintHop_set_htlc_minimum_msat(this.ptr, val.ptr);
119 if (this != null) { this.ptrs_to.AddLast(val); };
123 * The maximum value in msat available for routing with a single HTLC.
125 public Option_u64Z get_htlc_maximum_msat() {
126 long ret = bindings.RouteHintHop_get_htlc_maximum_msat(this.ptr);
128 if (ret >= 0 && ret <= 4096) { return null; }
129 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
130 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
135 * The maximum value in msat available for routing with a single HTLC.
137 public void set_htlc_maximum_msat(org.ldk.structs.Option_u64Z val) {
138 bindings.RouteHintHop_set_htlc_maximum_msat(this.ptr, val.ptr);
141 if (this != null) { this.ptrs_to.AddLast(val); };
145 * Constructs a new RouteHintHop given each field
147 public static RouteHintHop of(byte[] src_node_id_arg, long short_channel_id_arg, org.ldk.structs.RoutingFees fees_arg, short cltv_expiry_delta_arg, org.ldk.structs.Option_u64Z htlc_minimum_msat_arg, org.ldk.structs.Option_u64Z htlc_maximum_msat_arg) {
148 long ret = bindings.RouteHintHop_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(src_node_id_arg, 33)), short_channel_id_arg, fees_arg == null ? 0 : fees_arg.ptr, cltv_expiry_delta_arg, htlc_minimum_msat_arg.ptr, htlc_maximum_msat_arg.ptr);
149 GC.KeepAlive(src_node_id_arg);
150 GC.KeepAlive(short_channel_id_arg);
151 GC.KeepAlive(fees_arg);
152 GC.KeepAlive(cltv_expiry_delta_arg);
153 GC.KeepAlive(htlc_minimum_msat_arg);
154 GC.KeepAlive(htlc_maximum_msat_arg);
155 if (ret >= 0 && ret <= 4096) { return null; }
156 org.ldk.structs.RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHintHop(null, ret); }
157 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
158 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fees_arg); };
159 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_minimum_msat_arg); };
160 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_maximum_msat_arg); };
164 internal long clone_ptr() {
165 long ret = bindings.RouteHintHop_clone_ptr(this.ptr);
171 * Creates a copy of the RouteHintHop
173 public RouteHintHop clone() {
174 long ret = bindings.RouteHintHop_clone(this.ptr);
176 if (ret >= 0 && ret <= 4096) { return null; }
177 org.ldk.structs.RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHintHop(null, ret); }
178 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
183 * Generates a non-cryptographic 64-bit hash of the RouteHintHop.
186 long ret = bindings.RouteHintHop_hash(this.ptr);
191 public override int GetHashCode() {
192 return (int)this.hash();
195 * Checks if two RouteHintHops contain equal inner contents.
196 * This ignores pointers and is_owned flags and looks at the values in fields.
197 * Two objects with NULL inner values will be considered "equal" here.
199 public bool eq(org.ldk.structs.RouteHintHop b) {
200 bool ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr);
203 if (this != null) { this.ptrs_to.AddLast(b); };
207 public override bool Equals(object o) {
208 if (!(o is RouteHintHop)) return false;
209 return this.eq((RouteHintHop)o);
212 * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
214 public byte[] write() {
215 long ret = bindings.RouteHintHop_write(this.ptr);
217 if (ret >= 0 && ret <= 4096) { return null; }
218 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
223 * Read a RouteHintHop from a byte array, created by RouteHintHop_write
225 public static Result_RouteHintHopDecodeErrorZ read(byte[] ser) {
226 long ret = bindings.RouteHintHop_read(InternalUtils.encodeUint8Array(ser));
228 if (ret >= 0 && ret <= 4096) { return null; }
229 Result_RouteHintHopDecodeErrorZ ret_hu_conv = Result_RouteHintHopDecodeErrorZ.constr_from_ptr(ret);