X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelManager.java;fp=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelManager.java;h=33ea282eba908f522a366a278342b12769f54aa9;hb=8f5edad2f310a130b658e1b530fe2516724c4d99;hp=a44a43a3e1f82ba02f23a7a2da3ac6014b30e8fc;hpb=976cee7605402903ce1de9e566a48e4cbe18ee29;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index a44a43a3..33ea282e 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -426,6 +426,20 @@ public class ChannelManager extends CommonBase { return ret_hu_conv; } + /** + * Send a payment that is probing the given route for liquidity. We calculate the + * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows + * us to easily discern them from real payments. + */ + public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_probe(RouteHop[] hops) { + long ret = bindings.ChannelManager_send_probe(this.ptr, hops != null ? Arrays.stream(hops).mapToLong(hops_conv_10 -> hops_conv_10 == null ? 0 : hops_conv_10.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(hops); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Call this upon creation of a funding transaction for the given channel. * @@ -485,7 +499,7 @@ public class ChannelManager extends CommonBase { * tying these addresses together and to this node. If you wish to preserve user privacy, * addresses should likely contain only Tor Onion addresses. * - * Panics if `addresses` is absurdly large (more than 500). + * Panics if `addresses` is absurdly large (more than 100). * * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */