1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
12 * Default::default() provides sane defaults for most configurations
13 * (but currently with 0 relay fees!)
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class UserConfig extends CommonBase {
17 UserConfig(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.UserConfig_free(ptr); }
25 * Channel config that we propose to our counterparty.
27 public ChannelHandshakeConfig get_own_channel_config() {
28 long ret = bindings.UserConfig_get_own_channel_config(this.ptr);
29 ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret);
30 ret_hu_conv.ptrs_to.add(this);
35 * Channel config that we propose to our counterparty.
37 public void set_own_channel_config(ChannelHandshakeConfig val) {
38 bindings.UserConfig_set_own_channel_config(this.ptr, val == null ? 0 : val.ptr & ~1);
39 this.ptrs_to.add(val);
43 * Limits applied to our counterparty's proposed channel config settings.
45 public ChannelHandshakeLimits get_peer_channel_config_limits() {
46 long ret = bindings.UserConfig_get_peer_channel_config_limits(this.ptr);
47 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
48 ret_hu_conv.ptrs_to.add(this);
53 * Limits applied to our counterparty's proposed channel config settings.
55 public void set_peer_channel_config_limits(ChannelHandshakeLimits val) {
56 bindings.UserConfig_set_peer_channel_config_limits(this.ptr, val == null ? 0 : val.ptr & ~1);
57 this.ptrs_to.add(val);
61 * Channel config which affects behavior during channel lifetime.
63 public ChannelConfig get_channel_options() {
64 long ret = bindings.UserConfig_get_channel_options(this.ptr);
65 ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
66 ret_hu_conv.ptrs_to.add(this);
71 * Channel config which affects behavior during channel lifetime.
73 public void set_channel_options(ChannelConfig val) {
74 bindings.UserConfig_set_channel_options(this.ptr, val == null ? 0 : val.ptr & ~1);
75 this.ptrs_to.add(val);
79 * Constructs a new UserConfig given each field
81 public static UserConfig of(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg) {
82 long ret = bindings.UserConfig_new(own_channel_config_arg == null ? 0 : own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg == null ? 0 : peer_channel_config_limits_arg.ptr & ~1, channel_options_arg == null ? 0 : channel_options_arg.ptr & ~1);
83 UserConfig ret_hu_conv = new UserConfig(null, ret);
84 ret_hu_conv.ptrs_to.add(ret_hu_conv);
85 ret_hu_conv.ptrs_to.add(own_channel_config_arg);
86 ret_hu_conv.ptrs_to.add(peer_channel_config_limits_arg);
87 ret_hu_conv.ptrs_to.add(channel_options_arg);
92 * Creates a copy of the UserConfig
94 public UserConfig clone() {
95 long ret = bindings.UserConfig_clone(this.ptr);
96 UserConfig ret_hu_conv = new UserConfig(null, ret);
97 ret_hu_conv.ptrs_to.add(this);
102 * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
104 public static UserConfig with_default() {
105 long ret = bindings.UserConfig_default();
106 UserConfig ret_hu_conv = new UserConfig(null, ret);
107 ret_hu_conv.ptrs_to.add(ret_hu_conv);