X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FUserConfig.java;h=3f5c2ba0dcbbb496a36906b5004ca81ab82550ae;hb=b6cc0960eaee5a5bbc7fde79a56152d6dcd649d8;hp=8e871e21f71f8a4c965f95ec75c17bdb75cad8fe;hpb=a9b82019e7ffa7d32d44943133bb64e1197bd2f1;p=ldk-java diff --git a/src/main/java/org/ldk/structs/UserConfig.java b/src/main/java/org/ldk/structs/UserConfig.java index 8e871e21..3f5c2ba0 100644 --- a/src/main/java/org/ldk/structs/UserConfig.java +++ b/src/main/java/org/ldk/structs/UserConfig.java @@ -5,6 +5,13 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * Top-level config which holds ChannelHandshakeLimits and ChannelConfig. + * + * Default::default() provides sane defaults for most configurations + * (but currently with 0 relay fees!) + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UserConfig extends CommonBase { UserConfig(Object _dummy, long ptr) { super(ptr); } @@ -14,57 +21,90 @@ public class UserConfig extends CommonBase { if (ptr != 0) { bindings.UserConfig_free(ptr); } } - public UserConfig clone() { - long ret = bindings.UserConfig_clone(this.ptr); - UserConfig ret_hu_conv = new UserConfig(null, ret); - return ret_hu_conv; - } - + /** + * Channel config that we propose to our counterparty. + */ public ChannelHandshakeConfig get_own_channel_config() { long ret = bindings.UserConfig_get_own_channel_config(this.ptr); ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret); + ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Channel config that we propose to our counterparty. + */ public void set_own_channel_config(ChannelHandshakeConfig val) { bindings.UserConfig_set_own_channel_config(this.ptr, val == null ? 0 : val.ptr & ~1); this.ptrs_to.add(val); } + /** + * Limits applied to our counterparty's proposed channel config settings. + */ public ChannelHandshakeLimits get_peer_channel_config_limits() { long ret = bindings.UserConfig_get_peer_channel_config_limits(this.ptr); ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret); + ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Limits applied to our counterparty's proposed channel config settings. + */ public void set_peer_channel_config_limits(ChannelHandshakeLimits val) { bindings.UserConfig_set_peer_channel_config_limits(this.ptr, val == null ? 0 : val.ptr & ~1); this.ptrs_to.add(val); } + /** + * Channel config which affects behavior during channel lifetime. + */ public ChannelConfig get_channel_options() { long ret = bindings.UserConfig_get_channel_options(this.ptr); ChannelConfig ret_hu_conv = new ChannelConfig(null, ret); + ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Channel config which affects behavior during channel lifetime. + */ public void set_channel_options(ChannelConfig val) { bindings.UserConfig_set_channel_options(this.ptr, val == null ? 0 : val.ptr & ~1); this.ptrs_to.add(val); } - public static UserConfig constructor_new(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg) { + /** + * Constructs a new UserConfig given each field + */ + public static UserConfig of(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg) { 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); UserConfig ret_hu_conv = new UserConfig(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(own_channel_config_arg); ret_hu_conv.ptrs_to.add(peer_channel_config_limits_arg); ret_hu_conv.ptrs_to.add(channel_options_arg); return ret_hu_conv; } - public static UserConfig constructor_default() { + /** + * Creates a copy of the UserConfig + */ + public UserConfig clone() { + long ret = bindings.UserConfig_clone(this.ptr); + UserConfig ret_hu_conv = new UserConfig(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. + */ + public static UserConfig with_default() { long ret = bindings.UserConfig_default(); UserConfig ret_hu_conv = new UserConfig(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; }