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 byte[] ret = bindings.UpdateFulfillHTLC_get_channel_id(this.ptr);
32 public void set_channel_id(byte[] val) {
33 bindings.UpdateFulfillHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
41 public long get_htlc_id() {
42 long ret = bindings.UpdateFulfillHTLC_get_htlc_id(this.ptr);
50 public void set_htlc_id(long val) {
51 bindings.UpdateFulfillHTLC_set_htlc_id(this.ptr, val);
57 * The pre-image of the payment hash, allowing HTLC redemption
59 public byte[] get_payment_preimage() {
60 byte[] ret = bindings.UpdateFulfillHTLC_get_payment_preimage(this.ptr);
66 * The pre-image of the payment hash, allowing HTLC redemption
68 public void set_payment_preimage(byte[] val) {
69 bindings.UpdateFulfillHTLC_set_payment_preimage(this.ptr, InternalUtils.check_arr_len(val, 32));
75 * Constructs a new UpdateFulfillHTLC given each field
77 public static UpdateFulfillHTLC of(byte[] channel_id_arg, long htlc_id_arg, byte[] payment_preimage_arg) {
78 long ret = bindings.UpdateFulfillHTLC_new(InternalUtils.check_arr_len(channel_id_arg, 32), htlc_id_arg, InternalUtils.check_arr_len(payment_preimage_arg, 32));
79 GC.KeepAlive(channel_id_arg);
80 GC.KeepAlive(htlc_id_arg);
81 GC.KeepAlive(payment_preimage_arg);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 org.ldk.structs.UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, ret); }
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
88 internal long clone_ptr() {
89 long ret = bindings.UpdateFulfillHTLC_clone_ptr(this.ptr);
95 * Creates a copy of the UpdateFulfillHTLC
97 public UpdateFulfillHTLC clone() {
98 long ret = bindings.UpdateFulfillHTLC_clone(this.ptr);
100 if (ret >= 0 && ret <= 4096) { return null; }
101 org.ldk.structs.UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, ret); }
102 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
107 * Checks if two UpdateFulfillHTLCs contain equal inner contents.
108 * This ignores pointers and is_owned flags and looks at the values in fields.
109 * Two objects with NULL inner values will be considered "equal" here.
111 public bool eq(org.ldk.structs.UpdateFulfillHTLC b) {
112 bool ret = bindings.UpdateFulfillHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
115 if (this != null) { this.ptrs_to.AddLast(b); };
119 public override bool Equals(object o) {
120 if (!(o is UpdateFulfillHTLC)) return false;
121 return this.eq((UpdateFulfillHTLC)o);
124 * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
126 public byte[] write() {
127 byte[] ret = bindings.UpdateFulfillHTLC_write(this.ptr);
133 * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
135 public static Result_UpdateFulfillHTLCDecodeErrorZ read(byte[] ser) {
136 long ret = bindings.UpdateFulfillHTLC_read(ser);
138 if (ret >= 0 && ret <= 4096) { return null; }
139 Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret);