1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * Features used within a `node_announcement` message.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class NodeFeatures extends CommonBase {
15 NodeFeatures(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.NodeFeatures_free(ptr); }
23 * Checks if two NodeFeaturess contain equal inner contents.
24 * This ignores pointers and is_owned flags and looks at the values in fields.
25 * Two objects with NULL inner values will be considered "equal" here.
27 public boolean eq(NodeFeatures b) {
28 boolean ret = bindings.NodeFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
34 long ret = bindings.NodeFeatures_clone_ptr(this.ptr);
39 * Creates a copy of the NodeFeatures
41 public NodeFeatures clone() {
42 long ret = bindings.NodeFeatures_clone(this.ptr);
43 if (ret >= 0 && ret <= 4096) { return null; }
44 NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); }
45 ret_hu_conv.ptrs_to.add(this);
50 * Create a blank Features with no features set
52 public static NodeFeatures empty() {
53 long ret = bindings.NodeFeatures_empty();
54 if (ret >= 0 && ret <= 4096) { return null; }
55 NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); }
56 ret_hu_conv.ptrs_to.add(ret_hu_conv);
61 * Creates a Features with the bits set which are known by the implementation
63 public static NodeFeatures known() {
64 long ret = bindings.NodeFeatures_known();
65 if (ret >= 0 && ret <= 4096) { return null; }
66 NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); }
67 ret_hu_conv.ptrs_to.add(ret_hu_conv);
72 * Returns true if this `Features` object contains unknown feature flags which are set as
75 public boolean requires_unknown_bits() {
76 boolean ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
81 * Returns whether the `payment_secret` feature is supported.
83 public boolean supports_payment_secret() {
84 boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
89 * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
91 public byte[] write() {
92 byte[] ret = bindings.NodeFeatures_write(this.ptr);
97 * Read a NodeFeatures from a byte array, created by NodeFeatures_write
99 public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
100 long ret = bindings.NodeFeatures_read(ser);
101 if (ret >= 0 && ret <= 4096) { return null; }
102 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);