1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Details about one direction of a channel. Received
11 * within a channel update.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class DirectionalChannelInfo extends CommonBase {
15 DirectionalChannelInfo(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.DirectionalChannelInfo_free(ptr); }
23 * When the last update to the channel direction was issued.
24 * Value is opaque, as set in the announcement.
26 public int get_last_update() {
27 int ret = bindings.DirectionalChannelInfo_get_last_update(this.ptr);
32 * When the last update to the channel direction was issued.
33 * Value is opaque, as set in the announcement.
35 public void set_last_update(int val) {
36 bindings.DirectionalChannelInfo_set_last_update(this.ptr, val);
40 * Whether the channel can be currently used for payments (in this one direction).
42 public boolean get_enabled() {
43 boolean ret = bindings.DirectionalChannelInfo_get_enabled(this.ptr);
48 * Whether the channel can be currently used for payments (in this one direction).
50 public void set_enabled(boolean val) {
51 bindings.DirectionalChannelInfo_set_enabled(this.ptr, val);
55 * The difference in CLTV values that you must have when routing through this channel.
57 public short get_cltv_expiry_delta() {
58 short ret = bindings.DirectionalChannelInfo_get_cltv_expiry_delta(this.ptr);
63 * The difference in CLTV values that you must have when routing through this channel.
65 public void set_cltv_expiry_delta(short val) {
66 bindings.DirectionalChannelInfo_set_cltv_expiry_delta(this.ptr, val);
70 * The minimum value, which must be relayed to the next hop via the channel
72 public long get_htlc_minimum_msat() {
73 long ret = bindings.DirectionalChannelInfo_get_htlc_minimum_msat(this.ptr);
78 * The minimum value, which must be relayed to the next hop via the channel
80 public void set_htlc_minimum_msat(long val) {
81 bindings.DirectionalChannelInfo_set_htlc_minimum_msat(this.ptr, val);
85 * Fees charged when the channel is used for routing
87 public RoutingFees get_fees() {
88 long ret = bindings.DirectionalChannelInfo_get_fees(this.ptr);
89 RoutingFees ret_hu_conv = new RoutingFees(null, ret);
90 ret_hu_conv.ptrs_to.add(this);
95 * Fees charged when the channel is used for routing
97 public void set_fees(RoutingFees val) {
98 bindings.DirectionalChannelInfo_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1);
99 this.ptrs_to.add(val);
103 * Most recent update for the channel received from the network
104 * Mostly redundant with the data we store in fields explicitly.
105 * Everything else is useful only for sending out for initial routing sync.
106 * Not stored if contains excess data to prevent DoS.
108 public ChannelUpdate get_last_update_message() {
109 long ret = bindings.DirectionalChannelInfo_get_last_update_message(this.ptr);
110 ChannelUpdate ret_hu_conv = new ChannelUpdate(null, ret);
111 ret_hu_conv.ptrs_to.add(this);
116 * Most recent update for the channel received from the network
117 * Mostly redundant with the data we store in fields explicitly.
118 * Everything else is useful only for sending out for initial routing sync.
119 * Not stored if contains excess data to prevent DoS.
121 public void set_last_update_message(ChannelUpdate val) {
122 bindings.DirectionalChannelInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr & ~1);
123 this.ptrs_to.add(val);
127 * Creates a copy of the DirectionalChannelInfo
129 public DirectionalChannelInfo clone() {
130 long ret = bindings.DirectionalChannelInfo_clone(this.ptr);
131 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
132 ret_hu_conv.ptrs_to.add(this);
137 * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
139 public byte[] write() {
140 byte[] ret = bindings.DirectionalChannelInfo_write(this.ptr);
145 * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
147 public static Result_DirectionalChannelInfoDecodeErrorZ constructor_read(byte[] ser) {
148 long ret = bindings.DirectionalChannelInfo_read(ser);
149 Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret);