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 * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
12 * to better separate parameters.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelCounterparty extends CommonBase {
16 ChannelCounterparty(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.ChannelCounterparty_free(ptr); }
24 * The node_id of our counterparty
26 public byte[] get_node_id() {
27 byte[] ret = bindings.ChannelCounterparty_get_node_id(this.ptr);
32 * The node_id of our counterparty
34 public void set_node_id(byte[] val) {
35 bindings.ChannelCounterparty_set_node_id(this.ptr, val);
39 * The Features the channel counterparty provided upon last connection.
40 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
41 * many routing-relevant features are present in the init context.
43 public InitFeatures get_features() {
44 long ret = bindings.ChannelCounterparty_get_features(this.ptr);
45 if (ret < 1024) { return null; }
46 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
47 ret_hu_conv.ptrs_to.add(this);
52 * The Features the channel counterparty provided upon last connection.
53 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
54 * many routing-relevant features are present in the init context.
56 public void set_features(InitFeatures val) {
57 bindings.ChannelCounterparty_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
58 this.ptrs_to.add(val);
62 * The value, in satoshis, that must always be held in the channel for our counterparty. This
63 * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
64 * claiming at least this value on chain.
66 * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
68 * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
70 public long get_unspendable_punishment_reserve() {
71 long ret = bindings.ChannelCounterparty_get_unspendable_punishment_reserve(this.ptr);
76 * The value, in satoshis, that must always be held in the channel for our counterparty. This
77 * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
78 * claiming at least this value on chain.
80 * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
82 * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
84 public void set_unspendable_punishment_reserve(long val) {
85 bindings.ChannelCounterparty_set_unspendable_punishment_reserve(this.ptr, val);
89 * Creates a copy of the ChannelCounterparty
91 public ChannelCounterparty clone() {
92 long ret = bindings.ChannelCounterparty_clone(this.ptr);
93 if (ret < 1024) { return null; }
94 ChannelCounterparty ret_hu_conv = new ChannelCounterparty(null, ret);
95 ret_hu_conv.ptrs_to.add(this);