X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FHTLCFailChannelUpdate.java;h=a935293794e15901ddae3c0f75acce171f1ad38e;hb=fed2245c60159f6c074c9ed5c0f3ce273ad9841b;hp=63224cd8fb1183b9e3509d584aeb8acf6c13757f;hpb=110f2f104ba8fc34caa7e34e04737f36f064b050;p=ldk-java diff --git a/src/main/java/org/ldk/structs/HTLCFailChannelUpdate.java b/src/main/java/org/ldk/structs/HTLCFailChannelUpdate.java index 63224cd8..a9352937 100644 --- a/src/main/java/org/ldk/structs/HTLCFailChannelUpdate.java +++ b/src/main/java/org/ldk/structs/HTLCFailChannelUpdate.java @@ -8,36 +8,51 @@ import java.util.Arrays; @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class HTLCFailChannelUpdate extends CommonBase { private HTLCFailChannelUpdate(Object _dummy, long ptr) { super(ptr); } - long conv_to_c() { assert false; return 0; /* Should only be called on subclasses */ } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.HTLCFailChannelUpdate_free(ptr); } + } static HTLCFailChannelUpdate constr_from_ptr(long ptr) { bindings.LDKHTLCFailChannelUpdate raw_val = bindings.LDKHTLCFailChannelUpdate_ref_from_ptr(ptr); if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage.class) { - return new ChannelUpdateMessage(null, ptr); + return new ChannelUpdateMessage(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage)raw_val); } if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelClosed.class) { - return new ChannelClosed(null, ptr); + return new ChannelClosed(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelClosed)raw_val); } if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.NodeFailure.class) { - return new NodeFailure(null, ptr); + return new NodeFailure(ptr, (bindings.LDKHTLCFailChannelUpdate.NodeFailure)raw_val); } assert false; return null; // Unreachable without extending the (internal) bindings interface } public final static class ChannelUpdateMessage extends HTLCFailChannelUpdate { - public ChannelUpdate msg; - private ChannelUpdateMessage(Object _dummy, long ptr) { super(null, ptr); } - @Override long conv_to_c() { return 0; /*XXX*/ } + public final ChannelUpdate msg; + private ChannelUpdateMessage(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage obj) { + super(null, ptr); + long msg = obj.msg; + ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg); + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + } } public final static class ChannelClosed extends HTLCFailChannelUpdate { - public long short_channel_id; - public boolean is_permanent; - private ChannelClosed(Object _dummy, long ptr) { super(null, ptr); } - @Override long conv_to_c() { return 0; /*XXX*/ } + public final long short_channel_id; + public final boolean is_permanent; + private ChannelClosed(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelClosed obj) { + super(null, ptr); + this.short_channel_id = obj.short_channel_id; + this.is_permanent = obj.is_permanent; + } } public final static class NodeFailure extends HTLCFailChannelUpdate { - public byte[] node_id; - public boolean is_permanent; - private NodeFailure(Object _dummy, long ptr) { super(null, ptr); } - @Override long conv_to_c() { return 0; /*XXX*/ } + public final byte[] node_id; + public final boolean is_permanent; + private NodeFailure(long ptr, bindings.LDKHTLCFailChannelUpdate.NodeFailure obj) { + super(null, ptr); + this.node_id = obj.node_id; + this.is_permanent = obj.is_permanent; + } } }