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 long ret = bindings.UpdateAddHTLC_get_channel_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
34 public void set_channel_id(byte[] val) {
35 bindings.UpdateAddHTLC_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
43 public long get_htlc_id() {
44 long ret = bindings.UpdateAddHTLC_get_htlc_id(this.ptr);
52 public void set_htlc_id(long val) {
53 bindings.UpdateAddHTLC_set_htlc_id(this.ptr, val);
59 * The HTLC value in milli-satoshi
61 public long get_amount_msat() {
62 long ret = bindings.UpdateAddHTLC_get_amount_msat(this.ptr);
68 * The HTLC value in milli-satoshi
70 public void set_amount_msat(long val) {
71 bindings.UpdateAddHTLC_set_amount_msat(this.ptr, val);
77 * The payment hash, the pre-image of which controls HTLC redemption
79 public byte[] get_payment_hash() {
80 long ret = bindings.UpdateAddHTLC_get_payment_hash(this.ptr);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
88 * The payment hash, the pre-image of which controls HTLC redemption
90 public void set_payment_hash(byte[] val) {
91 bindings.UpdateAddHTLC_set_payment_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
97 * The expiry height of the HTLC
99 public int get_cltv_expiry() {
100 int ret = bindings.UpdateAddHTLC_get_cltv_expiry(this.ptr);
106 * The expiry height of the HTLC
108 public void set_cltv_expiry(int val) {
109 bindings.UpdateAddHTLC_set_cltv_expiry(this.ptr, val);
115 * The extra fee skimmed by the sender of this message. See
116 * [`ChannelConfig::accept_underpaying_htlcs`].
118 * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
120 public Option_u64Z get_skimmed_fee_msat() {
121 long ret = bindings.UpdateAddHTLC_get_skimmed_fee_msat(this.ptr);
123 if (ret >= 0 && ret <= 4096) { return null; }
124 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
125 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
130 * The extra fee skimmed by the sender of this message. See
131 * [`ChannelConfig::accept_underpaying_htlcs`].
133 * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
135 public void set_skimmed_fee_msat(org.ldk.structs.Option_u64Z val) {
136 bindings.UpdateAddHTLC_set_skimmed_fee_msat(this.ptr, val.ptr);
139 if (this != null) { this.ptrs_to.AddLast(val); };
142 internal long clone_ptr() {
143 long ret = bindings.UpdateAddHTLC_clone_ptr(this.ptr);
149 * Creates a copy of the UpdateAddHTLC
151 public UpdateAddHTLC clone() {
152 long ret = bindings.UpdateAddHTLC_clone(this.ptr);
154 if (ret >= 0 && ret <= 4096) { return null; }
155 org.ldk.structs.UpdateAddHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateAddHTLC(null, ret); }
156 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
161 * Checks if two UpdateAddHTLCs contain equal inner contents.
162 * This ignores pointers and is_owned flags and looks at the values in fields.
163 * Two objects with NULL inner values will be considered "equal" here.
165 public bool eq(org.ldk.structs.UpdateAddHTLC b) {
166 bool ret = bindings.UpdateAddHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
169 if (this != null) { this.ptrs_to.AddLast(b); };
173 public override bool Equals(object o) {
174 if (!(o is UpdateAddHTLC)) return false;
175 return this.eq((UpdateAddHTLC)o);
178 * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
180 public byte[] write() {
181 long ret = bindings.UpdateAddHTLC_write(this.ptr);
183 if (ret >= 0 && ret <= 4096) { return null; }
184 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
189 * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
191 public static Result_UpdateAddHTLCDecodeErrorZ read(byte[] ser) {
192 long ret = bindings.UpdateAddHTLC_read(InternalUtils.encodeUint8Array(ser));
194 if (ret >= 0 && ret <= 4096) { return null; }
195 Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret);