6 namespace org { namespace ldk { namespace structs {
10 * An [`update_add_htlc`] message to be sent to or received from a peer.
12 * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc
14 public class UpdateAddHTLC : CommonBase {
15 internal UpdateAddHTLC(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.UpdateAddHTLC_free(ptr); }
23 public byte[] get_channel_id() {
24 byte[] ret = bindings.UpdateAddHTLC_get_channel_id(this.ptr);
32 public void set_channel_id(byte[] val) {
33 bindings.UpdateAddHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
41 public long get_htlc_id() {
42 long ret = bindings.UpdateAddHTLC_get_htlc_id(this.ptr);
50 public void set_htlc_id(long val) {
51 bindings.UpdateAddHTLC_set_htlc_id(this.ptr, val);
57 * The HTLC value in milli-satoshi
59 public long get_amount_msat() {
60 long ret = bindings.UpdateAddHTLC_get_amount_msat(this.ptr);
66 * The HTLC value in milli-satoshi
68 public void set_amount_msat(long val) {
69 bindings.UpdateAddHTLC_set_amount_msat(this.ptr, val);
75 * The payment hash, the pre-image of which controls HTLC redemption
77 public byte[] get_payment_hash() {
78 byte[] ret = bindings.UpdateAddHTLC_get_payment_hash(this.ptr);
84 * The payment hash, the pre-image of which controls HTLC redemption
86 public void set_payment_hash(byte[] val) {
87 bindings.UpdateAddHTLC_set_payment_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
93 * The expiry height of the HTLC
95 public int get_cltv_expiry() {
96 int ret = bindings.UpdateAddHTLC_get_cltv_expiry(this.ptr);
102 * The expiry height of the HTLC
104 public void set_cltv_expiry(int val) {
105 bindings.UpdateAddHTLC_set_cltv_expiry(this.ptr, val);
111 * The extra fee skimmed by the sender of this message. See
112 * [`ChannelConfig::accept_underpaying_htlcs`].
114 * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
116 public Option_u64Z get_skimmed_fee_msat() {
117 long ret = bindings.UpdateAddHTLC_get_skimmed_fee_msat(this.ptr);
119 if (ret >= 0 && ret <= 4096) { return null; }
120 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
121 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
126 * The extra fee skimmed by the sender of this message. See
127 * [`ChannelConfig::accept_underpaying_htlcs`].
129 * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
131 public void set_skimmed_fee_msat(org.ldk.structs.Option_u64Z val) {
132 bindings.UpdateAddHTLC_set_skimmed_fee_msat(this.ptr, val.ptr);
135 if (this != null) { this.ptrs_to.AddLast(val); };
138 internal long clone_ptr() {
139 long ret = bindings.UpdateAddHTLC_clone_ptr(this.ptr);
145 * Creates a copy of the UpdateAddHTLC
147 public UpdateAddHTLC clone() {
148 long ret = bindings.UpdateAddHTLC_clone(this.ptr);
150 if (ret >= 0 && ret <= 4096) { return null; }
151 org.ldk.structs.UpdateAddHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateAddHTLC(null, ret); }
152 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
157 * Checks if two UpdateAddHTLCs contain equal inner contents.
158 * This ignores pointers and is_owned flags and looks at the values in fields.
159 * Two objects with NULL inner values will be considered "equal" here.
161 public bool eq(org.ldk.structs.UpdateAddHTLC b) {
162 bool ret = bindings.UpdateAddHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
165 if (this != null) { this.ptrs_to.AddLast(b); };
169 public override bool Equals(object o) {
170 if (!(o is UpdateAddHTLC)) return false;
171 return this.eq((UpdateAddHTLC)o);
174 * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
176 public byte[] write() {
177 byte[] ret = bindings.UpdateAddHTLC_write(this.ptr);
183 * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
185 public static Result_UpdateAddHTLCDecodeErrorZ read(byte[] ser) {
186 long ret = bindings.UpdateAddHTLC_read(ser);
188 if (ret >= 0 && ret <= 4096) { return null; }
189 Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret);