X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FEffectiveCapacity.java;h=c021ba1c91af959544108376cbd5aa3cdde4357b;hb=32973ea2749f8efd05b543dd774763513013b38b;hp=74c59b732adcd6a5671c024bf0c50be36766cb2d;hpb=09cf977593c69de53e558d5221ccd59b45c5c53d;p=ldk-java diff --git a/src/main/java/org/ldk/structs/EffectiveCapacity.java b/src/main/java/org/ldk/structs/EffectiveCapacity.java index 74c59b73..c021ba1c 100644 --- a/src/main/java/org/ldk/structs/EffectiveCapacity.java +++ b/src/main/java/org/ldk/structs/EffectiveCapacity.java @@ -27,8 +27,8 @@ public class EffectiveCapacity extends CommonBase { if (raw_val.getClass() == bindings.LDKEffectiveCapacity.ExactLiquidity.class) { return new ExactLiquidity(ptr, (bindings.LDKEffectiveCapacity.ExactLiquidity)raw_val); } - if (raw_val.getClass() == bindings.LDKEffectiveCapacity.MaximumHTLC.class) { - return new MaximumHTLC(ptr, (bindings.LDKEffectiveCapacity.MaximumHTLC)raw_val); + if (raw_val.getClass() == bindings.LDKEffectiveCapacity.AdvertisedMaxHTLC.class) { + return new AdvertisedMaxHTLC(ptr, (bindings.LDKEffectiveCapacity.AdvertisedMaxHTLC)raw_val); } if (raw_val.getClass() == bindings.LDKEffectiveCapacity.Total.class) { return new Total(ptr, (bindings.LDKEffectiveCapacity.Total)raw_val); @@ -36,6 +36,9 @@ public class EffectiveCapacity extends CommonBase { if (raw_val.getClass() == bindings.LDKEffectiveCapacity.Infinite.class) { return new Infinite(ptr, (bindings.LDKEffectiveCapacity.Infinite)raw_val); } + if (raw_val.getClass() == bindings.LDKEffectiveCapacity.HintMaxHTLC.class) { + return new HintMaxHTLC(ptr, (bindings.LDKEffectiveCapacity.HintMaxHTLC)raw_val); + } if (raw_val.getClass() == bindings.LDKEffectiveCapacity.Unknown.class) { return new Unknown(ptr, (bindings.LDKEffectiveCapacity.Unknown)raw_val); } @@ -60,12 +63,12 @@ public class EffectiveCapacity extends CommonBase { /** * The maximum HTLC amount in one direction as advertised on the gossip network. */ - public final static class MaximumHTLC extends EffectiveCapacity { + public final static class AdvertisedMaxHTLC extends EffectiveCapacity { /** * The maximum HTLC amount denominated in millisatoshi. */ public final long amount_msat; - private MaximumHTLC(long ptr, bindings.LDKEffectiveCapacity.MaximumHTLC obj) { + private AdvertisedMaxHTLC(long ptr, bindings.LDKEffectiveCapacity.AdvertisedMaxHTLC obj) { super(null, ptr); this.amount_msat = obj.amount_msat; } @@ -81,14 +84,11 @@ public class EffectiveCapacity extends CommonBase { /** * The maximum HTLC amount denominated in millisatoshi. */ - public final org.ldk.structs.Option_u64Z htlc_maximum_msat; + public final long htlc_maximum_msat; private Total(long ptr, bindings.LDKEffectiveCapacity.Total obj) { super(null, ptr); this.capacity_msat = obj.capacity_msat; - long htlc_maximum_msat = obj.htlc_maximum_msat; - org.ldk.structs.Option_u64Z htlc_maximum_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(htlc_maximum_msat); - htlc_maximum_msat_hu_conv.ptrs_to.add(this); - this.htlc_maximum_msat = htlc_maximum_msat_hu_conv; + this.htlc_maximum_msat = obj.htlc_maximum_msat; } } /** @@ -100,6 +100,19 @@ public class EffectiveCapacity extends CommonBase { super(null, ptr); } } + /** + * The maximum HTLC amount as provided by an invoice route hint. + */ + public final static class HintMaxHTLC extends EffectiveCapacity { + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + public final long amount_msat; + private HintMaxHTLC(long ptr, bindings.LDKEffectiveCapacity.HintMaxHTLC obj) { + super(null, ptr); + this.amount_msat = obj.amount_msat; + } + } /** * A capacity that is unknown possibly because either the chain state is unavailable to know * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network. @@ -123,7 +136,7 @@ public class EffectiveCapacity extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -135,32 +148,32 @@ public class EffectiveCapacity extends CommonBase { Reference.reachabilityFence(liquidity_msat); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } /** - * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity + * Utility method to constructs a new AdvertisedMaxHTLC-variant EffectiveCapacity */ - public static EffectiveCapacity maximum_htlc(long amount_msat) { - long ret = bindings.EffectiveCapacity_maximum_htlc(amount_msat); + public static EffectiveCapacity advertised_max_htlc(long amount_msat) { + long ret = bindings.EffectiveCapacity_advertised_max_htlc(amount_msat); Reference.reachabilityFence(amount_msat); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } /** * Utility method to constructs a new Total-variant EffectiveCapacity */ - public static EffectiveCapacity total(long capacity_msat, Option_u64Z htlc_maximum_msat) { - long ret = bindings.EffectiveCapacity_total(capacity_msat, htlc_maximum_msat.ptr); + public static EffectiveCapacity total(long capacity_msat, long htlc_maximum_msat) { + long ret = bindings.EffectiveCapacity_total(capacity_msat, htlc_maximum_msat); Reference.reachabilityFence(capacity_msat); Reference.reachabilityFence(htlc_maximum_msat); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } @@ -171,7 +184,19 @@ public class EffectiveCapacity extends CommonBase { long ret = bindings.EffectiveCapacity_infinite(); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new HintMaxHTLC-variant EffectiveCapacity + */ + public static EffectiveCapacity hint_max_htlc(long amount_msat) { + long ret = bindings.EffectiveCapacity_hint_max_htlc(amount_msat); + Reference.reachabilityFence(amount_msat); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } @@ -182,7 +207,7 @@ public class EffectiveCapacity extends CommonBase { long ret = bindings.EffectiveCapacity_unknown(); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; }