import org.ldk.util.*;
import java.util.Arrays;
+
+/**
+ * Private routing information
+ *
+ * # Invariants
+ * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
+ */
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
public class RouteHint extends CommonBase {
RouteHint(Object _dummy, long ptr) { super(ptr); }
if (ptr != 0) { bindings.RouteHint_free(ptr); }
}
- public byte[] get_src_node_id() {
- byte[] ret = bindings.RouteHint_get_src_node_id(this.ptr);
- return ret;
- }
-
- public void set_src_node_id(byte[] val) {
- bindings.RouteHint_set_src_node_id(this.ptr, val);
- }
-
- public long get_short_channel_id() {
- long ret = bindings.RouteHint_get_short_channel_id(this.ptr);
+ /**
+ * Checks if two RouteHints contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(RouteHint b) {
+ boolean ret = bindings.RouteHint_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
return ret;
}
- public void set_short_channel_id(long val) {
- bindings.RouteHint_set_short_channel_id(this.ptr, val);
- }
-
- public RoutingFees get_fees() {
- long ret = bindings.RouteHint_get_fees(this.ptr);
- RoutingFees ret_hu_conv = new RoutingFees(null, ret);
+ /**
+ * Creates a copy of the RouteHint
+ */
+ public RouteHint clone() {
+ long ret = bindings.RouteHint_clone(this.ptr);
+ RouteHint ret_hu_conv = new RouteHint(null, ret);
ret_hu_conv.ptrs_to.add(this);
return ret_hu_conv;
}
- public void set_fees(RoutingFees val) {
- bindings.RouteHint_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1);
- this.ptrs_to.add(val);
- }
-
- public short get_cltv_expiry_delta() {
- short ret = bindings.RouteHint_get_cltv_expiry_delta(this.ptr);
- return ret;
- }
-
- public void set_cltv_expiry_delta(short val) {
- bindings.RouteHint_set_cltv_expiry_delta(this.ptr, val);
+ /**
+ * Create a new (partial) route from a list of hops
+ */
+ public static Result_RouteHintCreationErrorZ of(RouteHintHop[] hops) {
+ long ret = bindings.RouteHint_new(Arrays.stream(hops).mapToLong(hops_conv_14 -> hops_conv_14 == null ? 0 : hops_conv_14.ptr & ~1).toArray());
+ Result_RouteHintCreationErrorZ ret_hu_conv = Result_RouteHintCreationErrorZ.constr_from_ptr(ret);
+ /* TODO 2 RouteHintHop */;
+ return ret_hu_conv;
}
- public RouteHint clone() {
- long ret = bindings.RouteHint_clone(this.ptr);
- RouteHint ret_hu_conv = new RouteHint(null, ret);
- ret_hu_conv.ptrs_to.add(this);
- return ret_hu_conv;
+ /**
+ * Returrn the underlying vector of hops
+ */
+ public RouteHintHop[] into_inner() {
+ long[] ret = bindings.RouteHint_into_inner(this.ptr);
+ RouteHintHop[] ret_conv_14_arr = new RouteHintHop[ret.length];
+ for (int o = 0; o < ret.length; o++) {
+ long ret_conv_14 = ret[o];
+ RouteHintHop ret_conv_14_hu_conv = new RouteHintHop(null, ret_conv_14);
+ ret_conv_14_hu_conv.ptrs_to.add(this);
+ ret_conv_14_arr[o] = ret_conv_14_hu_conv;
+ }
+ this.ptrs_to.add(this);
+ return ret_conv_14_arr;
}
}