1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * A shutdown message to be sent or received from a peer
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class Shutdown extends CommonBase {
15 Shutdown(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.Shutdown_free(ptr); }
25 public byte[] get_channel_id() {
26 byte[] ret = bindings.Shutdown_get_channel_id(this.ptr);
33 public void set_channel_id(byte[] val) {
34 bindings.Shutdown_set_channel_id(this.ptr, val);
38 * The destination of this peer's funds on closing.
39 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
41 public byte[] get_scriptpubkey() {
42 byte[] ret = bindings.Shutdown_get_scriptpubkey(this.ptr);
47 * The destination of this peer's funds on closing.
48 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
50 public void set_scriptpubkey(byte[] val) {
51 bindings.Shutdown_set_scriptpubkey(this.ptr, val);
55 * Constructs a new Shutdown given each field
57 public static Shutdown of(byte[] channel_id_arg, byte[] scriptpubkey_arg) {
58 long ret = bindings.Shutdown_new(channel_id_arg, scriptpubkey_arg);
59 if (ret < 1024) { return null; }
60 Shutdown ret_hu_conv = new Shutdown(null, ret);
61 ret_hu_conv.ptrs_to.add(ret_hu_conv);
66 * Creates a copy of the Shutdown
68 public Shutdown clone() {
69 long ret = bindings.Shutdown_clone(this.ptr);
70 if (ret < 1024) { return null; }
71 Shutdown ret_hu_conv = new Shutdown(null, ret);
72 ret_hu_conv.ptrs_to.add(this);
77 * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
79 public byte[] write() {
80 byte[] ret = bindings.Shutdown_write(this.ptr);
85 * Read a Shutdown from a byte array, created by Shutdown_write
87 public static Result_ShutdownDecodeErrorZ read(byte[] ser) {
88 long ret = bindings.Shutdown_read(ser);
89 if (ret < 1024) { return null; }
90 Result_ShutdownDecodeErrorZ ret_hu_conv = Result_ShutdownDecodeErrorZ.constr_from_ptr(ret);