X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FPrivateRoute.java;h=2c9931ad04929033d29fa57366d798c280b4ea1e;hb=0d48e557e83ef085cc92c2de63b9c81c061ce78c;hp=74c1bbb983d2922693c6dd463c0b5eaf3aee2963;hpb=de7e3d9b2470913881ee0995d2dc57deb9778647;p=ldk-java diff --git a/src/main/java/org/ldk/structs/PrivateRoute.java b/src/main/java/org/ldk/structs/PrivateRoute.java index 74c1bbb9..2c9931ad 100644 --- a/src/main/java/org/ldk/structs/PrivateRoute.java +++ b/src/main/java/org/ldk/structs/PrivateRoute.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import javax.annotation.Nullable; /** @@ -21,6 +22,25 @@ public class PrivateRoute extends CommonBase { if (ptr != 0) { bindings.PrivateRoute_free(ptr); } } + /** + * Creates a copy of the PrivateRoute + */ + public PrivateRoute clone() { + long ret = bindings.PrivateRoute_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + PrivateRoute ret_hu_conv = new PrivateRoute(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Checks if two PrivateRoutes contain equal inner contents. + */ + public long hash() { + long ret = bindings.PrivateRoute_hash(this.ptr); + return ret; + } + /** * Checks if two PrivateRoutes contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32,23 +52,13 @@ public class PrivateRoute extends CommonBase { return ret; } - /** - * Creates a copy of the PrivateRoute - */ - public PrivateRoute clone() { - long ret = bindings.PrivateRoute_clone(this.ptr); - PrivateRoute ret_hu_conv = new PrivateRoute(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - /** * Creates a new (partial) route from a list of hops */ public static Result_PrivateRouteCreationErrorZ of(RouteHint hops) { long ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(hops); return ret_hu_conv; } @@ -57,9 +67,10 @@ public class PrivateRoute extends CommonBase { */ public RouteHint into_inner() { long ret = bindings.PrivateRoute_into_inner(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } RouteHint ret_hu_conv = new RouteHint(null, ret); ret_hu_conv.ptrs_to.add(this); - this.ptrs_to.add(this); + ; return ret_hu_conv; }