6 namespace org { namespace ldk { namespace structs {
10 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
11 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
12 * preimage claim backward will lead to loss of funds.
14 public class HTLCUpdate : CommonBase {
15 internal HTLCUpdate(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.HTLCUpdate_free(ptr); }
20 internal long clone_ptr() {
21 long ret = bindings.HTLCUpdate_clone_ptr(this.ptr);
27 * Creates a copy of the HTLCUpdate
29 public HTLCUpdate clone() {
30 long ret = bindings.HTLCUpdate_clone(this.ptr);
32 if (ret >= 0 && ret <= 4096) { return null; }
33 org.ldk.structs.HTLCUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCUpdate(null, ret); }
34 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
39 * Checks if two HTLCUpdates contain equal inner contents.
40 * This ignores pointers and is_owned flags and looks at the values in fields.
41 * Two objects with NULL inner values will be considered "equal" here.
43 public bool eq(org.ldk.structs.HTLCUpdate b) {
44 bool ret = bindings.HTLCUpdate_eq(this.ptr, b == null ? 0 : b.ptr);
47 if (this != null) { this.ptrs_to.AddLast(b); };
51 public override bool Equals(object o) {
52 if (!(o is HTLCUpdate)) return false;
53 return this.eq((HTLCUpdate)o);
56 * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
58 public byte[] write() {
59 byte[] ret = bindings.HTLCUpdate_write(this.ptr);
65 * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
67 public static Result_HTLCUpdateDecodeErrorZ read(byte[] ser) {
68 long ret = bindings.HTLCUpdate_read(ser);
70 if (ret >= 0 && ret <= 4096) { return null; }
71 Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret);