X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FPrivateRoute.java;h=c4f11b6c8983fd035f0a4b9fa497d9de3630db4b;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=be446f1bbad8c6325e4636e2f262138981f245cc;hpb=ba1af51214a8ea2de62b84cd23b6145173c71752;p=ldk-java diff --git a/src/main/java/org/ldk/structs/PrivateRoute.java b/src/main/java/org/ldk/structs/PrivateRoute.java index be446f1b..c4f11b6c 100644 --- a/src/main/java/org/ldk/structs/PrivateRoute.java +++ b/src/main/java/org/ldk/structs/PrivateRoute.java @@ -22,14 +22,8 @@ public class PrivateRoute extends CommonBase { if (ptr != 0) { bindings.PrivateRoute_free(ptr); } } - /** - * Checks if two PrivateRoutes 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(PrivateRoute b) { - boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1); - this.ptrs_to.add(b); + long clone_ptr() { + long ret = bindings.PrivateRoute_clone_ptr(this.ptr); return ret; } @@ -38,20 +32,38 @@ public class PrivateRoute extends CommonBase { */ public PrivateRoute clone() { long ret = bindings.PrivateRoute_clone(this.ptr); - if (ret < 1024) { return null; } - PrivateRoute ret_hu_conv = new PrivateRoute(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + PrivateRoute ret_hu_conv = null; if (ret < 0 || ret > 4096) { 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. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(PrivateRoute b) { + boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); + return ret; + } + /** * 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 < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(hops); return ret_hu_conv; } @@ -60,10 +72,10 @@ public class PrivateRoute extends CommonBase { */ public RouteHint into_inner() { long ret = bindings.PrivateRoute_into_inner(this.ptr); - if (ret < 1024) { return null; } - RouteHint ret_hu_conv = new RouteHint(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + RouteHint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHint(null, ret); } ret_hu_conv.ptrs_to.add(this); - this.ptrs_to.add(this); + ; return ret_hu_conv; }