1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
11 * with our counterparty.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ChannelConfig extends CommonBase {
15 ChannelConfig(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.ChannelConfig_free(ptr); }
23 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
24 * This may be allowed to change at runtime in a later update, however doing so must result in
25 * update messages sent to notify all nodes of our updated relay fee.
29 public int get_fee_proportional_millionths() {
30 int ret = bindings.ChannelConfig_get_fee_proportional_millionths(this.ptr);
35 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
36 * This may be allowed to change at runtime in a later update, however doing so must result in
37 * update messages sent to notify all nodes of our updated relay fee.
41 public void set_fee_proportional_millionths(int val) {
42 bindings.ChannelConfig_set_fee_proportional_millionths(this.ptr, val);
46 * Set to announce the channel publicly and notify all nodes that they can route via this
49 * This should only be set to true for nodes which expect to be online reliably.
51 * As the node which funds a channel picks this value this will only apply for new outbound
52 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
54 * This cannot be changed after the initial channel handshake.
56 * Default value: false.
58 public boolean get_announced_channel() {
59 boolean ret = bindings.ChannelConfig_get_announced_channel(this.ptr);
64 * Set to announce the channel publicly and notify all nodes that they can route via this
67 * This should only be set to true for nodes which expect to be online reliably.
69 * As the node which funds a channel picks this value this will only apply for new outbound
70 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
72 * This cannot be changed after the initial channel handshake.
74 * Default value: false.
76 public void set_announced_channel(boolean val) {
77 bindings.ChannelConfig_set_announced_channel(this.ptr, val);
81 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
82 * supports it, they will then enforce the mutual-close output to us matches what we provided
83 * at intialization, preventing us from closing to an alternate pubkey.
85 * This is set to true by default to provide a slight increase in security, though ultimately
86 * any attacker who is able to take control of a channel can just as easily send the funds via
87 * lightning payments, so we never require that our counterparties support this option.
89 * This cannot be changed after a channel has been initialized.
91 * Default value: true.
93 public boolean get_commit_upfront_shutdown_pubkey() {
94 boolean ret = bindings.ChannelConfig_get_commit_upfront_shutdown_pubkey(this.ptr);
99 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
100 * supports it, they will then enforce the mutual-close output to us matches what we provided
101 * at intialization, preventing us from closing to an alternate pubkey.
103 * This is set to true by default to provide a slight increase in security, though ultimately
104 * any attacker who is able to take control of a channel can just as easily send the funds via
105 * lightning payments, so we never require that our counterparties support this option.
107 * This cannot be changed after a channel has been initialized.
109 * Default value: true.
111 public void set_commit_upfront_shutdown_pubkey(boolean val) {
112 bindings.ChannelConfig_set_commit_upfront_shutdown_pubkey(this.ptr, val);
116 * Constructs a new ChannelConfig given each field
118 public static ChannelConfig constructor_new(int fee_proportional_millionths_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) {
119 long ret = bindings.ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
120 ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
121 ret_hu_conv.ptrs_to.add(ret_hu_conv);
126 * Creates a copy of the ChannelConfig
128 public ChannelConfig clone() {
129 long ret = bindings.ChannelConfig_clone(this.ptr);
130 ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
131 ret_hu_conv.ptrs_to.add(this);
136 * Creates a "default" ChannelConfig. See other documentaiton for details on what this implies.
138 public static ChannelConfig constructor_default() {
139 long ret = bindings.ChannelConfig_default();
140 ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
141 ret_hu_conv.ptrs_to.add(ret_hu_conv);
146 * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
148 public byte[] write() {
149 byte[] ret = bindings.ChannelConfig_write(this.ptr);
154 * Read a ChannelConfig from a byte array, created by ChannelConfig_write
156 public static Result_ChannelConfigDecodeErrorZ constructor_read(byte[] ser) {
157 long ret = bindings.ChannelConfig_read(ser);
158 Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret);