6 namespace org { namespace ldk { namespace structs {
10 * An encrypted payload and node id corresponding to a hop in a payment or onion message path, to
11 * be encoded in the sender's onion packet. These hops cannot be identified by outside observers
12 * and thus can be used to hide the identity of the recipient.
14 public class BlindedHop : CommonBase {
15 internal BlindedHop(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.BlindedHop_free(ptr); }
21 * The blinded node id of this hop in a [`BlindedPath`].
23 public byte[] get_blinded_node_id() {
24 long ret = bindings.BlindedHop_get_blinded_node_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
32 * The blinded node id of this hop in a [`BlindedPath`].
34 public void set_blinded_node_id(byte[] val) {
35 bindings.BlindedHop_set_blinded_node_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
41 * The encrypted payload intended for this hop in a [`BlindedPath`].
43 * Returns a copy of the field.
45 public byte[] get_encrypted_payload() {
46 long ret = bindings.BlindedHop_get_encrypted_payload(this.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
54 * The encrypted payload intended for this hop in a [`BlindedPath`].
56 public void set_encrypted_payload(byte[] val) {
57 bindings.BlindedHop_set_encrypted_payload(this.ptr, InternalUtils.encodeUint8Array(val));
63 * Constructs a new BlindedHop given each field
65 public static BlindedHop of(byte[] blinded_node_id_arg, byte[] encrypted_payload_arg) {
66 long ret = bindings.BlindedHop_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(blinded_node_id_arg, 33)), InternalUtils.encodeUint8Array(encrypted_payload_arg));
67 GC.KeepAlive(blinded_node_id_arg);
68 GC.KeepAlive(encrypted_payload_arg);
69 if (ret >= 0 && ret <= 4096) { return null; }
70 org.ldk.structs.BlindedHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHop(null, ret); }
71 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
75 internal long clone_ptr() {
76 long ret = bindings.BlindedHop_clone_ptr(this.ptr);
82 * Creates a copy of the BlindedHop
84 public BlindedHop clone() {
85 long ret = bindings.BlindedHop_clone(this.ptr);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 org.ldk.structs.BlindedHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHop(null, ret); }
89 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
94 * Generates a non-cryptographic 64-bit hash of the BlindedHop.
97 long ret = bindings.BlindedHop_hash(this.ptr);
102 public override int GetHashCode() {
103 return (int)this.hash();
106 * Checks if two BlindedHops contain equal inner contents.
107 * This ignores pointers and is_owned flags and looks at the values in fields.
108 * Two objects with NULL inner values will be considered "equal" here.
110 public bool eq(org.ldk.structs.BlindedHop b) {
111 bool ret = bindings.BlindedHop_eq(this.ptr, b.ptr);
114 if (this != null) { this.ptrs_to.AddLast(b); };
118 public override bool Equals(object o) {
119 if (!(o is BlindedHop)) return false;
120 return this.eq((BlindedHop)o);
123 * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
125 public byte[] write() {
126 long ret = bindings.BlindedHop_write(this.ptr);
128 if (ret >= 0 && ret <= 4096) { return null; }
129 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
134 * Read a BlindedHop from a byte array, created by BlindedHop_write
136 public static Result_BlindedHopDecodeErrorZ read(byte[] ser) {
137 long ret = bindings.BlindedHop_read(InternalUtils.encodeUint8Array(ser));
139 if (ret >= 0 && ret <= 4096) { return null; }
140 Result_BlindedHopDecodeErrorZ ret_hu_conv = Result_BlindedHopDecodeErrorZ.constr_from_ptr(ret);