Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / HTLCFailChannelUpdate.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8
9 /**
10  * The information we received from a peer along the route of a payment we originated. This is
11  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
12  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class HTLCFailChannelUpdate extends CommonBase {
16         private HTLCFailChannelUpdate(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.HTLCFailChannelUpdate_free(ptr); }
21         }
22         static HTLCFailChannelUpdate constr_from_ptr(long ptr) {
23                 bindings.LDKHTLCFailChannelUpdate raw_val = bindings.LDKHTLCFailChannelUpdate_ref_from_ptr(ptr);
24                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage.class) {
25                         return new ChannelUpdateMessage(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage)raw_val);
26                 }
27                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelClosed.class) {
28                         return new ChannelClosed(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelClosed)raw_val);
29                 }
30                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.NodeFailure.class) {
31                         return new NodeFailure(ptr, (bindings.LDKHTLCFailChannelUpdate.NodeFailure)raw_val);
32                 }
33                 assert false; return null; // Unreachable without extending the (internal) bindings interface
34         }
35
36         public final static class ChannelUpdateMessage extends HTLCFailChannelUpdate {
37                 public final ChannelUpdate msg;
38                 private ChannelUpdateMessage(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage obj) {
39                         super(null, ptr);
40                         long msg = obj.msg;
41                         ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
42                         msg_hu_conv.ptrs_to.add(this);
43                         this.msg = msg_hu_conv;
44                 }
45         }
46         public final static class ChannelClosed extends HTLCFailChannelUpdate {
47                 public final long short_channel_id;
48                 public final boolean is_permanent;
49                 private ChannelClosed(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelClosed obj) {
50                         super(null, ptr);
51                         this.short_channel_id = obj.short_channel_id;
52                         this.is_permanent = obj.is_permanent;
53                 }
54         }
55         public final static class NodeFailure extends HTLCFailChannelUpdate {
56                 public final byte[] node_id;
57                 public final boolean is_permanent;
58                 private NodeFailure(long ptr, bindings.LDKHTLCFailChannelUpdate.NodeFailure obj) {
59                         super(null, ptr);
60                         this.node_id = obj.node_id;
61                         this.is_permanent = obj.is_permanent;
62                 }
63         }
64         /**
65          * Creates a copy of the HTLCFailChannelUpdate
66          */
67         public HTLCFailChannelUpdate clone() {
68                 long ret = bindings.HTLCFailChannelUpdate_clone(this.ptr);
69                 HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
70                 ret_hu_conv.ptrs_to.add(this);
71                 return ret_hu_conv;
72         }
73
74 }