6 namespace org { namespace ldk { namespace structs {
9 * Represents the set of gossip messages that require a signature from a node's identity key.
11 public class UnsignedGossipMessage : CommonBase {
12 protected UnsignedGossipMessage(object _dummy, long ptr) : base(ptr) { }
13 ~UnsignedGossipMessage() {
14 if (ptr != 0) { bindings.UnsignedGossipMessage_free(ptr); }
17 internal static UnsignedGossipMessage constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKUnsignedGossipMessage_ty_from_ptr(ptr);
20 case 0: return new UnsignedGossipMessage_ChannelAnnouncement(ptr);
21 case 1: return new UnsignedGossipMessage_ChannelUpdate(ptr);
22 case 2: return new UnsignedGossipMessage_NodeAnnouncement(ptr);
24 throw new ArgumentException("Impossible enum variant");
28 /** A UnsignedGossipMessage of type ChannelAnnouncement */
29 public class UnsignedGossipMessage_ChannelAnnouncement : UnsignedGossipMessage {
30 public UnsignedChannelAnnouncement channel_announcement;
31 internal UnsignedGossipMessage_ChannelAnnouncement(long ptr) : base(null, ptr) {
32 long channel_announcement = bindings.LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(ptr);
33 org.ldk.structs.UnsignedChannelAnnouncement channel_announcement_hu_conv = null; if (channel_announcement < 0 || channel_announcement > 4096) { channel_announcement_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, channel_announcement); }
34 if (channel_announcement_hu_conv != null) { channel_announcement_hu_conv.ptrs_to.AddLast(this); };
35 this.channel_announcement = channel_announcement_hu_conv;
38 /** A UnsignedGossipMessage of type ChannelUpdate */
39 public class UnsignedGossipMessage_ChannelUpdate : UnsignedGossipMessage {
40 public UnsignedChannelUpdate channel_update;
41 internal UnsignedGossipMessage_ChannelUpdate(long ptr) : base(null, ptr) {
42 long channel_update = bindings.LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(ptr);
43 org.ldk.structs.UnsignedChannelUpdate channel_update_hu_conv = null; if (channel_update < 0 || channel_update > 4096) { channel_update_hu_conv = new org.ldk.structs.UnsignedChannelUpdate(null, channel_update); }
44 if (channel_update_hu_conv != null) { channel_update_hu_conv.ptrs_to.AddLast(this); };
45 this.channel_update = channel_update_hu_conv;
48 /** A UnsignedGossipMessage of type NodeAnnouncement */
49 public class UnsignedGossipMessage_NodeAnnouncement : UnsignedGossipMessage {
50 public UnsignedNodeAnnouncement node_announcement;
51 internal UnsignedGossipMessage_NodeAnnouncement(long ptr) : base(null, ptr) {
52 long node_announcement = bindings.LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(ptr);
53 org.ldk.structs.UnsignedNodeAnnouncement node_announcement_hu_conv = null; if (node_announcement < 0 || node_announcement > 4096) { node_announcement_hu_conv = new org.ldk.structs.UnsignedNodeAnnouncement(null, node_announcement); }
54 if (node_announcement_hu_conv != null) { node_announcement_hu_conv.ptrs_to.AddLast(this); };
55 this.node_announcement = node_announcement_hu_conv;
58 internal long clone_ptr() {
59 long ret = bindings.UnsignedGossipMessage_clone_ptr(this.ptr);
65 * Creates a copy of the UnsignedGossipMessage
67 public UnsignedGossipMessage clone() {
68 long ret = bindings.UnsignedGossipMessage_clone(this.ptr);
70 if (ret >= 0 && ret <= 4096) { return null; }
71 org.ldk.structs.UnsignedGossipMessage ret_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(ret);
72 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
77 * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage
79 public static UnsignedGossipMessage channel_announcement(org.ldk.structs.UnsignedChannelAnnouncement a) {
80 long ret = bindings.UnsignedGossipMessage_channel_announcement(a == null ? 0 : a.ptr);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 org.ldk.structs.UnsignedGossipMessage ret_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(ret);
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
85 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
90 * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage
92 public static UnsignedGossipMessage channel_update(org.ldk.structs.UnsignedChannelUpdate a) {
93 long ret = bindings.UnsignedGossipMessage_channel_update(a == null ? 0 : a.ptr);
95 if (ret >= 0 && ret <= 4096) { return null; }
96 org.ldk.structs.UnsignedGossipMessage ret_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(ret);
97 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
98 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
103 * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage
105 public static UnsignedGossipMessage node_announcement(org.ldk.structs.UnsignedNodeAnnouncement a) {
106 long ret = bindings.UnsignedGossipMessage_node_announcement(a == null ? 0 : a.ptr);
108 if (ret >= 0 && ret <= 4096) { return null; }
109 org.ldk.structs.UnsignedGossipMessage ret_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(ret);
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
111 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
116 * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read
118 public byte[] write() {
119 byte[] ret = bindings.UnsignedGossipMessage_write(this.ptr);