6 namespace org { namespace ldk { namespace structs {
10 * A [`shutdown`] message to be sent to or received from a peer.
12 * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown
14 public class Shutdown : CommonBase {
15 internal Shutdown(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.Shutdown_free(ptr); }
23 public byte[] get_channel_id() {
24 byte[] ret = bindings.Shutdown_get_channel_id(this.ptr);
32 public void set_channel_id(byte[] val) {
33 bindings.Shutdown_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39 * The destination of this peer's funds on closing.
41 * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
43 public byte[] get_scriptpubkey() {
44 byte[] ret = bindings.Shutdown_get_scriptpubkey(this.ptr);
50 * The destination of this peer's funds on closing.
52 * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
54 public void set_scriptpubkey(byte[] val) {
55 bindings.Shutdown_set_scriptpubkey(this.ptr, val);
61 * Constructs a new Shutdown given each field
63 public static Shutdown of(byte[] channel_id_arg, byte[] scriptpubkey_arg) {
64 long ret = bindings.Shutdown_new(InternalUtils.check_arr_len(channel_id_arg, 32), scriptpubkey_arg);
65 GC.KeepAlive(channel_id_arg);
66 GC.KeepAlive(scriptpubkey_arg);
67 if (ret >= 0 && ret <= 4096) { return null; }
68 org.ldk.structs.Shutdown ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Shutdown(null, ret); }
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
73 internal long clone_ptr() {
74 long ret = bindings.Shutdown_clone_ptr(this.ptr);
80 * Creates a copy of the Shutdown
82 public Shutdown clone() {
83 long ret = bindings.Shutdown_clone(this.ptr);
85 if (ret >= 0 && ret <= 4096) { return null; }
86 org.ldk.structs.Shutdown ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Shutdown(null, ret); }
87 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
92 * Checks if two Shutdowns contain equal inner contents.
93 * This ignores pointers and is_owned flags and looks at the values in fields.
94 * Two objects with NULL inner values will be considered "equal" here.
96 public bool eq(org.ldk.structs.Shutdown b) {
97 bool ret = bindings.Shutdown_eq(this.ptr, b == null ? 0 : b.ptr);
100 if (this != null) { this.ptrs_to.AddLast(b); };
104 public override bool Equals(object o) {
105 if (!(o is Shutdown)) return false;
106 return this.eq((Shutdown)o);
109 * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
111 public byte[] write() {
112 byte[] ret = bindings.Shutdown_write(this.ptr);
118 * Read a Shutdown from a byte array, created by Shutdown_write
120 public static Result_ShutdownDecodeErrorZ read(byte[] ser) {
121 long ret = bindings.Shutdown_read(ser);
123 if (ret >= 0 && ret <= 4096) { return null; }
124 Result_ShutdownDecodeErrorZ ret_hu_conv = Result_ShutdownDecodeErrorZ.constr_from_ptr(ret);