/**
- * An update_add_htlc message to be sent or received from a peer
+ * An [`update_add_htlc`] message to be sent to or received from a peer.
+ *
+ * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc
*/
public class UpdateAddHTLC : CommonBase {
internal UpdateAddHTLC(object _dummy, long ptr) : base(ptr) { }
* The channel ID
*/
public byte[] get_channel_id() {
- byte[] ret = bindings.UpdateAddHTLC_get_channel_id(this.ptr);
+ long ret = bindings.UpdateAddHTLC_get_channel_id(this.ptr);
GC.KeepAlive(this);
- return ret;
+ if (ret >= 0 && ret <= 4096) { return null; }
+ byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+ return ret_conv;
}
/**
* The channel ID
*/
public void set_channel_id(byte[] val) {
- bindings.UpdateAddHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
+ bindings.UpdateAddHTLC_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
GC.KeepAlive(this);
GC.KeepAlive(val);
}
* The payment hash, the pre-image of which controls HTLC redemption
*/
public byte[] get_payment_hash() {
- byte[] ret = bindings.UpdateAddHTLC_get_payment_hash(this.ptr);
+ long ret = bindings.UpdateAddHTLC_get_payment_hash(this.ptr);
GC.KeepAlive(this);
- return ret;
+ if (ret >= 0 && ret <= 4096) { return null; }
+ byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+ return ret_conv;
}
/**
* The payment hash, the pre-image of which controls HTLC redemption
*/
public void set_payment_hash(byte[] val) {
- bindings.UpdateAddHTLC_set_payment_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
+ bindings.UpdateAddHTLC_set_payment_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
GC.KeepAlive(this);
GC.KeepAlive(val);
}
GC.KeepAlive(val);
}
+ /**
+ * The extra fee skimmed by the sender of this message. See
+ * [`ChannelConfig::accept_underpaying_htlcs`].
+ *
+ * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
+ */
+ public Option_u64Z get_skimmed_fee_msat() {
+ long ret = bindings.UpdateAddHTLC_get_skimmed_fee_msat(this.ptr);
+ GC.KeepAlive(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * The extra fee skimmed by the sender of this message. See
+ * [`ChannelConfig::accept_underpaying_htlcs`].
+ *
+ * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
+ */
+ public void set_skimmed_fee_msat(org.ldk.structs.Option_u64Z val) {
+ bindings.UpdateAddHTLC_set_skimmed_fee_msat(this.ptr, val.ptr);
+ GC.KeepAlive(this);
+ GC.KeepAlive(val);
+ if (this != null) { this.ptrs_to.AddLast(val); };
+ }
+
internal long clone_ptr() {
long ret = bindings.UpdateAddHTLC_clone_ptr(this.ptr);
GC.KeepAlive(this);
* Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
*/
public byte[] write() {
- byte[] ret = bindings.UpdateAddHTLC_write(this.ptr);
+ long ret = bindings.UpdateAddHTLC_write(this.ptr);
GC.KeepAlive(this);
- return ret;
+ if (ret >= 0 && ret <= 4096) { return null; }
+ byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+ return ret_conv;
}
/**
* Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
*/
public static Result_UpdateAddHTLCDecodeErrorZ read(byte[] ser) {
- long ret = bindings.UpdateAddHTLC_read(ser);
+ long ret = bindings.UpdateAddHTLC_read(InternalUtils.encodeUint8Array(ser));
GC.KeepAlive(ser);
if (ret >= 0 && ret <= 4096) { return null; }
Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret);