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 if (ret < 1024) { return null; }
45 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
46 ret_hu_conv.ptrs_to.add(this);
51 * The Features the channel counterparty provided upon last connection.
52 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
53 * many routing-relevant features are present in the init context.
55 public void set_features(InitFeatures val) {
56 bindings.ChannelCounterparty_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
57 this.ptrs_to.add(val);
61 * The value, in satoshis, that must always be held in the channel for our counterparty. This
62 * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
63 * claiming at least this value on chain.
65 * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
67 * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
69 public long get_unspendable_punishment_reserve() {
70 long ret = bindings.ChannelCounterparty_get_unspendable_punishment_reserve(this.ptr);
75 * The value, in satoshis, that must always be held in the channel for our counterparty. This
76 * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
77 * claiming at least this value on chain.
79 * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
81 * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
83 public void set_unspendable_punishment_reserve(long val) {
84 bindings.ChannelCounterparty_set_unspendable_punishment_reserve(this.ptr, val);
88 * Creates a copy of the ChannelCounterparty
90 public ChannelCounterparty clone() {
91 long ret = bindings.ChannelCounterparty_clone(this.ptr);
92 if (ret < 1024) { return null; }
93 ChannelCounterparty ret_hu_conv = new ChannelCounterparty(null, ret);
94 ret_hu_conv.ptrs_to.add(this);