6 namespace org { namespace ldk { namespace structs {
10 * An [`update_fulfill_htlc`] message to be sent to or received from a peer.
12 * [`update_fulfill_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
14 public class UpdateFulfillHTLC : CommonBase {
15 internal UpdateFulfillHTLC(object _dummy, long ptr) : base(ptr) { }
16 ~UpdateFulfillHTLC() {
17 if (ptr != 0) { bindings.UpdateFulfillHTLC_free(ptr); }
23 public byte[] get_channel_id() {
24 long ret = bindings.UpdateFulfillHTLC_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.UpdateFulfillHTLC_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
43 public long get_htlc_id() {
44 long ret = bindings.UpdateFulfillHTLC_get_htlc_id(this.ptr);
52 public void set_htlc_id(long val) {
53 bindings.UpdateFulfillHTLC_set_htlc_id(this.ptr, val);
59 * The pre-image of the payment hash, allowing HTLC redemption
61 public byte[] get_payment_preimage() {
62 long ret = bindings.UpdateFulfillHTLC_get_payment_preimage(this.ptr);
64 if (ret >= 0 && ret <= 4096) { return null; }
65 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
70 * The pre-image of the payment hash, allowing HTLC redemption
72 public void set_payment_preimage(byte[] val) {
73 bindings.UpdateFulfillHTLC_set_payment_preimage(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
79 * Constructs a new UpdateFulfillHTLC given each field
81 public static UpdateFulfillHTLC of(byte[] channel_id_arg, long htlc_id_arg, byte[] payment_preimage_arg) {
82 long ret = bindings.UpdateFulfillHTLC_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), htlc_id_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_preimage_arg, 32)));
83 GC.KeepAlive(channel_id_arg);
84 GC.KeepAlive(htlc_id_arg);
85 GC.KeepAlive(payment_preimage_arg);
86 if (ret >= 0 && ret <= 4096) { return null; }
87 org.ldk.structs.UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, ret); }
88 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
92 internal long clone_ptr() {
93 long ret = bindings.UpdateFulfillHTLC_clone_ptr(this.ptr);
99 * Creates a copy of the UpdateFulfillHTLC
101 public UpdateFulfillHTLC clone() {
102 long ret = bindings.UpdateFulfillHTLC_clone(this.ptr);
104 if (ret >= 0 && ret <= 4096) { return null; }
105 org.ldk.structs.UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, ret); }
106 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
111 * Checks if two UpdateFulfillHTLCs contain equal inner contents.
112 * This ignores pointers and is_owned flags and looks at the values in fields.
113 * Two objects with NULL inner values will be considered "equal" here.
115 public bool eq(org.ldk.structs.UpdateFulfillHTLC b) {
116 bool ret = bindings.UpdateFulfillHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
119 if (this != null) { this.ptrs_to.AddLast(b); };
123 public override bool Equals(object o) {
124 if (!(o is UpdateFulfillHTLC)) return false;
125 return this.eq((UpdateFulfillHTLC)o);
128 * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
130 public byte[] write() {
131 long ret = bindings.UpdateFulfillHTLC_write(this.ptr);
133 if (ret >= 0 && ret <= 4096) { return null; }
134 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
139 * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
141 public static Result_UpdateFulfillHTLCDecodeErrorZ read(byte[] ser) {
142 long ret = bindings.UpdateFulfillHTLC_read(InternalUtils.encodeUint8Array(ser));
144 if (ret >= 0 && ret <= 4096) { return null; }
145 Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret);