1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
11 * to better separate parameters.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ChannelCounterparty extends CommonBase {
15 ChannelCounterparty(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.ChannelCounterparty_free(ptr); }
23 * The node_id of our counterparty
25 public byte[] get_node_id() {
26 byte[] ret = bindings.ChannelCounterparty_get_node_id(this.ptr);
31 * The node_id of our counterparty
33 public void set_node_id(byte[] val) {
34 bindings.ChannelCounterparty_set_node_id(this.ptr, val);
38 * The Features the channel counterparty provided upon last connection.
39 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
40 * many routing-relevant features are present in the init context.
42 public InitFeatures get_features() {
43 long ret = bindings.ChannelCounterparty_get_features(this.ptr);
44 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
45 ret_hu_conv.ptrs_to.add(this);
50 * The Features the channel counterparty provided upon last connection.
51 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
52 * many routing-relevant features are present in the init context.
54 public void set_features(InitFeatures val) {
55 bindings.ChannelCounterparty_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
56 this.ptrs_to.add(val);
60 * The value, in satoshis, that must always be held in the channel for our counterparty. This
61 * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
62 * claiming at least this value on chain.
64 * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
66 * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
68 public long get_unspendable_punishment_reserve() {
69 long ret = bindings.ChannelCounterparty_get_unspendable_punishment_reserve(this.ptr);
74 * The value, in satoshis, that must always be held in the channel for our counterparty. This
75 * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
76 * claiming at least this value on chain.
78 * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
80 * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
82 public void set_unspendable_punishment_reserve(long val) {
83 bindings.ChannelCounterparty_set_unspendable_punishment_reserve(this.ptr, val);
87 * Creates a copy of the ChannelCounterparty
89 public ChannelCounterparty clone() {
90 long ret = bindings.ChannelCounterparty_clone(this.ptr);
91 ChannelCounterparty ret_hu_conv = new ChannelCounterparty(null, ret);
92 ret_hu_conv.ptrs_to.add(this);