6 namespace org { namespace ldk { namespace structs {
10 * Information about an HTLC that is part of a payment that can be claimed.
12 public class ClaimedHTLC : CommonBase {
13 internal ClaimedHTLC(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.ClaimedHTLC_free(ptr); }
19 * The `channel_id` of the channel over which the HTLC was received.
21 public byte[] get_channel_id() {
22 long ret = bindings.ClaimedHTLC_get_channel_id(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
30 * The `channel_id` of the channel over which the HTLC was received.
32 public void set_channel_id(byte[] val) {
33 bindings.ClaimedHTLC_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
39 * The `user_channel_id` of the channel over which the HTLC was received. This is the value
40 * passed in to [`ChannelManager::create_channel`] for outbound channels, or to
41 * [`ChannelManager::accept_inbound_channel`] for inbound channels if
42 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
43 * `user_channel_id` will be randomized for an inbound channel.
45 * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This
46 * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but
47 * was not actually claimed until after upgrading.)
49 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
50 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
51 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
53 public UInt128 get_user_channel_id() {
54 long ret = bindings.ClaimedHTLC_get_user_channel_id(this.ptr);
56 if (ret >= 0 && ret <= 4096) { return null; }
57 org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
62 * The `user_channel_id` of the channel over which the HTLC was received. This is the value
63 * passed in to [`ChannelManager::create_channel`] for outbound channels, or to
64 * [`ChannelManager::accept_inbound_channel`] for inbound channels if
65 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
66 * `user_channel_id` will be randomized for an inbound channel.
68 * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This
69 * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but
70 * was not actually claimed until after upgrading.)
72 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
73 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
74 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
76 public void set_user_channel_id(org.ldk.util.UInt128 val) {
77 bindings.ClaimedHTLC_set_user_channel_id(this.ptr, InternalUtils.encodeUint8Array(val.getLEBytes()));
83 * The block height at which this HTLC expires.
85 public int get_cltv_expiry() {
86 int ret = bindings.ClaimedHTLC_get_cltv_expiry(this.ptr);
92 * The block height at which this HTLC expires.
94 public void set_cltv_expiry(int val) {
95 bindings.ClaimedHTLC_set_cltv_expiry(this.ptr, val);
101 * The amount (in msats) of this part of an MPP.
103 public long get_value_msat() {
104 long ret = bindings.ClaimedHTLC_get_value_msat(this.ptr);
110 * The amount (in msats) of this part of an MPP.
112 public void set_value_msat(long val) {
113 bindings.ClaimedHTLC_set_value_msat(this.ptr, val);
119 * The extra fee our counterparty skimmed off the top of this HTLC, if any.
121 * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to
124 public long get_counterparty_skimmed_fee_msat() {
125 long ret = bindings.ClaimedHTLC_get_counterparty_skimmed_fee_msat(this.ptr);
131 * The extra fee our counterparty skimmed off the top of this HTLC, if any.
133 * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to
136 public void set_counterparty_skimmed_fee_msat(long val) {
137 bindings.ClaimedHTLC_set_counterparty_skimmed_fee_msat(this.ptr, val);
143 * Constructs a new ClaimedHTLC given each field
145 public static ClaimedHTLC of(byte[] channel_id_arg, org.ldk.util.UInt128 user_channel_id_arg, int cltv_expiry_arg, long value_msat_arg, long counterparty_skimmed_fee_msat_arg) {
146 long ret = bindings.ClaimedHTLC_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(user_channel_id_arg.getLEBytes()), cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
147 GC.KeepAlive(channel_id_arg);
148 GC.KeepAlive(user_channel_id_arg);
149 GC.KeepAlive(cltv_expiry_arg);
150 GC.KeepAlive(value_msat_arg);
151 GC.KeepAlive(counterparty_skimmed_fee_msat_arg);
152 if (ret >= 0 && ret <= 4096) { return null; }
153 org.ldk.structs.ClaimedHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClaimedHTLC(null, ret); }
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
158 internal long clone_ptr() {
159 long ret = bindings.ClaimedHTLC_clone_ptr(this.ptr);
165 * Creates a copy of the ClaimedHTLC
167 public ClaimedHTLC clone() {
168 long ret = bindings.ClaimedHTLC_clone(this.ptr);
170 if (ret >= 0 && ret <= 4096) { return null; }
171 org.ldk.structs.ClaimedHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClaimedHTLC(null, ret); }
172 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
177 * Checks if two ClaimedHTLCs contain equal inner contents.
178 * This ignores pointers and is_owned flags and looks at the values in fields.
179 * Two objects with NULL inner values will be considered "equal" here.
181 public bool eq(org.ldk.structs.ClaimedHTLC b) {
182 bool ret = bindings.ClaimedHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
185 if (this != null) { this.ptrs_to.AddLast(b); };
189 public override bool Equals(object o) {
190 if (!(o is ClaimedHTLC)) return false;
191 return this.eq((ClaimedHTLC)o);
194 * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read
196 public byte[] write() {
197 long ret = bindings.ClaimedHTLC_write(this.ptr);
199 if (ret >= 0 && ret <= 4096) { return null; }
200 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
205 * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write
207 public static Result_ClaimedHTLCDecodeErrorZ read(byte[] ser) {
208 long ret = bindings.ClaimedHTLC_read(InternalUtils.encodeUint8Array(ser));
210 if (ret >= 0 && ret <= 4096) { return null; }
211 Result_ClaimedHTLCDecodeErrorZ ret_hu_conv = Result_ClaimedHTLCDecodeErrorZ.constr_from_ptr(ret);