6 namespace org { namespace ldk { namespace structs {
9 * The unblinded node in a [`BlindedPath`].
11 public class IntroductionNode : CommonBase {
12 protected IntroductionNode(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.IntroductionNode_free(ptr); }
17 internal static IntroductionNode constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKIntroductionNode_ty_from_ptr(ptr);
20 case 0: return new IntroductionNode_NodeId(ptr);
21 case 1: return new IntroductionNode_DirectedShortChannelId(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A IntroductionNode of type NodeId */
28 public class IntroductionNode_NodeId : IntroductionNode {
29 public byte[] node_id;
30 internal IntroductionNode_NodeId(long ptr) : base(null, ptr) {
31 long node_id = bindings.LDKIntroductionNode_NodeId_get_node_id(ptr);
32 byte[] node_id_conv = InternalUtils.decodeUint8Array(node_id);
33 this.node_id = node_id_conv;
36 /** A IntroductionNode of type DirectedShortChannelId */
37 public class IntroductionNode_DirectedShortChannelId : IntroductionNode {
40 internal IntroductionNode_DirectedShortChannelId(long ptr) : base(null, ptr) {
41 this._0 = bindings.LDKIntroductionNode_DirectedShortChannelId_get__0(ptr);
42 this._1 = bindings.LDKIntroductionNode_DirectedShortChannelId_get__1(ptr);
45 internal long clone_ptr() {
46 long ret = bindings.IntroductionNode_clone_ptr(this.ptr);
52 * Creates a copy of the IntroductionNode
54 public IntroductionNode clone() {
55 long ret = bindings.IntroductionNode_clone(this.ptr);
57 if (ret >= 0 && ret <= 4096) { return null; }
58 org.ldk.structs.IntroductionNode ret_hu_conv = org.ldk.structs.IntroductionNode.constr_from_ptr(ret);
59 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
64 * Utility method to constructs a new NodeId-variant IntroductionNode
66 public static IntroductionNode node_id(byte[] a) {
67 long ret = bindings.IntroductionNode_node_id(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a, 33)));
69 if (ret >= 0 && ret <= 4096) { return null; }
70 org.ldk.structs.IntroductionNode ret_hu_conv = org.ldk.structs.IntroductionNode.constr_from_ptr(ret);
71 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
76 * Utility method to constructs a new DirectedShortChannelId-variant IntroductionNode
78 public static IntroductionNode directed_short_channel_id(Direction a, long b) {
79 long ret = bindings.IntroductionNode_directed_short_channel_id(a, b);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 org.ldk.structs.IntroductionNode ret_hu_conv = org.ldk.structs.IntroductionNode.constr_from_ptr(ret);
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
89 * Generates a non-cryptographic 64-bit hash of the IntroductionNode.
92 long ret = bindings.IntroductionNode_hash(this.ptr);
97 public override int GetHashCode() {
98 return (int)this.hash();
101 * Checks if two IntroductionNodes contain equal inner contents.
102 * This ignores pointers and is_owned flags and looks at the values in fields.
104 public bool eq(org.ldk.structs.IntroductionNode b) {
105 bool ret = bindings.IntroductionNode_eq(this.ptr, b.ptr);
111 public override bool Equals(object o) {
112 if (!(o is IntroductionNode)) return false;
113 return this.eq((IntroductionNode)o);