6 namespace org { namespace ldk { namespace structs {
10 * Onion messages and payments can be sent and received to blinded paths, which serve to hide the
11 * identity of the recipient.
13 public class BlindedPath : CommonBase {
14 internal BlindedPath(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.BlindedPath_free(ptr); }
19 internal long clone_ptr() {
20 long ret = bindings.BlindedPath_clone_ptr(this.ptr);
26 * Creates a copy of the BlindedPath
28 public BlindedPath clone() {
29 long ret = bindings.BlindedPath_clone(this.ptr);
31 if (ret >= 0 && ret <= 4096) { return null; }
32 org.ldk.structs.BlindedPath ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedPath(null, ret); }
33 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
38 * Generates a non-cryptographic 64-bit hash of the BlindedPath.
41 long ret = bindings.BlindedPath_hash(this.ptr);
46 public override int GetHashCode() {
47 return (int)this.hash();
50 * Checks if two BlindedPaths contain equal inner contents.
51 * This ignores pointers and is_owned flags and looks at the values in fields.
52 * Two objects with NULL inner values will be considered "equal" here.
54 public bool eq(org.ldk.structs.BlindedPath b) {
55 bool ret = bindings.BlindedPath_eq(this.ptr, b == null ? 0 : b.ptr);
58 if (this != null) { this.ptrs_to.AddLast(b); };
62 public override bool Equals(object o) {
63 if (!(o is BlindedPath)) return false;
64 return this.eq((BlindedPath)o);
67 * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
68 * pubkey in `node_pks` will be the destination node.
70 * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
72 public static Result_BlindedPathNoneZ new_for_message(byte[][] node_pks, org.ldk.structs.EntropySource entropy_source) {
73 long ret = bindings.BlindedPath_new_for_message(node_pks != null ? InternalUtils.mapArray(node_pks, node_pks_conv_8 => InternalUtils.check_arr_len(node_pks_conv_8, 33)) : null, entropy_source.ptr);
74 GC.KeepAlive(node_pks);
75 GC.KeepAlive(entropy_source);
76 if (ret >= 0 && ret <= 4096) { return null; }
77 Result_BlindedPathNoneZ ret_hu_conv = Result_BlindedPathNoneZ.constr_from_ptr(ret);
78 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(entropy_source); };
83 * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
85 public byte[] write() {
86 byte[] ret = bindings.BlindedPath_write(this.ptr);
92 * Read a BlindedPath from a byte array, created by BlindedPath_write
94 public static Result_BlindedPathDecodeErrorZ read(byte[] ser) {
95 long ret = bindings.BlindedPath_read(ser);
97 if (ret >= 0 && ret <= 4096) { return null; }
98 Result_BlindedPathDecodeErrorZ ret_hu_conv = Result_BlindedPathDecodeErrorZ.constr_from_ptr(ret);