+ * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
+ * given channel in the direction from `source` to `target`.
+ *
+ * The channel's capacity (less any other MPP parts which are also being considered for use in
+ * the same payment) is given by `channel_capacity_msat`. It may be guessed from various
+ * sources or assumed from no data at all.
+ *
+ * For hints provided in the invoice, we assume the channel has sufficient capacity to accept
+ * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other
+ * cases it is set to `Some`, even if we're guessing at the channel value.
+ *
+ * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC.
+ */
+ public long channel_penalty_msat(long short_channel_id, long send_amt_msat, Option_u64Z channel_capacity_msat, NodeId source, NodeId target) {
+ long ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id, send_amt_msat, channel_capacity_msat.ptr, source == null ? 0 : source.ptr & ~1, target == null ? 0 : target.ptr & ~1);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(short_channel_id);
+ Reference.reachabilityFence(send_amt_msat);
+ Reference.reachabilityFence(channel_capacity_msat);
+ Reference.reachabilityFence(source);
+ Reference.reachabilityFence(target);
+ 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);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(path);
+ Reference.reachabilityFence(short_channel_id);
+ }
+
+ /**
+ * Handles updating channel penalties after successfully routing along a path.
+ */
+ public void payment_path_successful(RouteHop[] path) {
+ bindings.Score_payment_path_successful(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(path);
+ }
+
+ /**
+ * Serialize the object into a byte array