Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / Score.java
index f7a0d95e9a229a20cb6c5e0cd5659ad340763c9d..902dc021d3a2ff3e18afee0f70957b43fd8dfa25 100644 (file)
@@ -27,26 +27,69 @@ public class Score extends CommonBase {
 
        public static interface ScoreInterface {
                /**
-                * Returns the fee in msats willing to be paid to avoid routing through the given channel.
+                * Returns the fee in msats willing to be paid to avoid routing through the given channel
+                * in the direction from `source` to `target`.
                 */
-               long channel_penalty_msat(long short_channel_id);
+               long channel_penalty_msat(long short_channel_id, NodeId source, NodeId target);
+               /**
+                * Handles updating channel penalties after failing to route through a channel.
+                */
+               void payment_path_failed(RouteHop[] path, long short_channel_id);
+               /**
+                * Serialize the object into a byte array
+                */
+               byte[] write();
        }
        private static class LDKScoreHolder { Score held; }
        public static Score new_impl(ScoreInterface arg) {
                final LDKScoreHolder impl_holder = new LDKScoreHolder();
                impl_holder.held = new Score(new bindings.LDKScore() {
-                       @Override public long channel_penalty_msat(long short_channel_id) {
-                               long ret = arg.channel_penalty_msat(short_channel_id);
+                       @Override public long channel_penalty_msat(long short_channel_id, long source, long target) {
+                               NodeId source_hu_conv = null; if (source < 0 || source > 4096) { source_hu_conv = new NodeId(null, source); }
+                               NodeId target_hu_conv = null; if (target < 0 || target > 4096) { target_hu_conv = new NodeId(null, target); }
+                               long ret = arg.channel_penalty_msat(short_channel_id, source_hu_conv, target_hu_conv);
+                               return ret;
+                       }
+                       @Override public void payment_path_failed(long[] path, long short_channel_id) {
+                               RouteHop[] path_conv_10_arr = new RouteHop[path.length];
+                               for (int k = 0; k < path.length; k++) {
+                                       long path_conv_10 = path[k];
+                                       RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new RouteHop(null, path_conv_10); }
+                                       path_conv_10_hu_conv.ptrs_to.add(this);
+                                       path_conv_10_arr[k] = path_conv_10_hu_conv;
+                               }
+                               arg.payment_path_failed(path_conv_10_arr, short_channel_id);
+                       }
+                       @Override public byte[] write() {
+                               byte[] ret = arg.write();
                                return ret;
                        }
                });
                return impl_holder.held;
        }
        /**
-        * Returns the fee in msats willing to be paid to avoid routing through the given channel.
+        * Returns the fee in msats willing to be paid to avoid routing through the given channel
+        * in the direction from `source` to `target`.
+        */
+       public long channel_penalty_msat(long short_channel_id, NodeId source, NodeId target) {
+               long ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id, source == null ? 0 : source.ptr & ~1, target == null ? 0 : target.ptr & ~1);
+               this.ptrs_to.add(source);
+               this.ptrs_to.add(target);
+               return ret;
+       }
+
+       /**
+        * Handles updating channel penalties after failing to route through a channel.
+        */
+       public void payment_path_failed(RouteHop[] path, long short_channel_id) {
+               bindings.Score_payment_path_failed(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null, short_channel_id);
+       }
+
+       /**
+        * Serialize the object into a byte array
         */
-       public long channel_penalty_msat(long short_channel_id) {
-               long ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id);
+       public byte[] write() {
+               byte[] ret = bindings.Score_write(this.ptr);
                return ret;
        }