6 namespace org { namespace ldk { namespace structs {
10 * An update_fulfill_htlc message to be sent or received from a peer
12 public class UpdateFulfillHTLC : CommonBase {
13 internal UpdateFulfillHTLC(object _dummy, long ptr) : base(ptr) { }
14 ~UpdateFulfillHTLC() {
15 if (ptr != 0) { bindings.UpdateFulfillHTLC_free(ptr); }
21 public byte[] get_channel_id() {
22 byte[] ret = bindings.UpdateFulfillHTLC_get_channel_id(this.ptr);
30 public void set_channel_id(byte[] val) {
31 bindings.UpdateFulfillHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39 public long get_htlc_id() {
40 long ret = bindings.UpdateFulfillHTLC_get_htlc_id(this.ptr);
48 public void set_htlc_id(long val) {
49 bindings.UpdateFulfillHTLC_set_htlc_id(this.ptr, val);
55 * The pre-image of the payment hash, allowing HTLC redemption
57 public byte[] get_payment_preimage() {
58 byte[] ret = bindings.UpdateFulfillHTLC_get_payment_preimage(this.ptr);
64 * The pre-image of the payment hash, allowing HTLC redemption
66 public void set_payment_preimage(byte[] val) {
67 bindings.UpdateFulfillHTLC_set_payment_preimage(this.ptr, InternalUtils.check_arr_len(val, 32));
73 * Constructs a new UpdateFulfillHTLC given each field
75 public static UpdateFulfillHTLC of(byte[] channel_id_arg, long htlc_id_arg, byte[] payment_preimage_arg) {
76 long ret = bindings.UpdateFulfillHTLC_new(InternalUtils.check_arr_len(channel_id_arg, 32), htlc_id_arg, InternalUtils.check_arr_len(payment_preimage_arg, 32));
77 GC.KeepAlive(channel_id_arg);
78 GC.KeepAlive(htlc_id_arg);
79 GC.KeepAlive(payment_preimage_arg);
80 if (ret >= 0 && ret <= 4096) { return null; }
81 org.ldk.structs.UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, ret); }
82 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
86 internal long clone_ptr() {
87 long ret = bindings.UpdateFulfillHTLC_clone_ptr(this.ptr);
93 * Creates a copy of the UpdateFulfillHTLC
95 public UpdateFulfillHTLC clone() {
96 long ret = bindings.UpdateFulfillHTLC_clone(this.ptr);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 org.ldk.structs.UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, ret); }
100 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
105 * Checks if two UpdateFulfillHTLCs contain equal inner contents.
106 * This ignores pointers and is_owned flags and looks at the values in fields.
107 * Two objects with NULL inner values will be considered "equal" here.
109 public bool eq(org.ldk.structs.UpdateFulfillHTLC b) {
110 bool ret = bindings.UpdateFulfillHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
113 if (this != null) { this.ptrs_to.AddLast(b); };
117 public override bool Equals(object o) {
118 if (!(o is UpdateFulfillHTLC)) return false;
119 return this.eq((UpdateFulfillHTLC)o);
122 * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
124 public byte[] write() {
125 byte[] ret = bindings.UpdateFulfillHTLC_write(this.ptr);
131 * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
133 public static Result_UpdateFulfillHTLCDecodeErrorZ read(byte[] ser) {
134 long ret = bindings.UpdateFulfillHTLC_read(ser);
136 if (ret >= 0 && ret <= 4096) { return null; }
137 Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret);