6 namespace org { namespace ldk { namespace structs {
10 * An [`update_fail_htlc`] message to be sent to or received from a peer.
12 * [`update_fail_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 UpdateFailHTLC : CommonBase {
15 internal UpdateFailHTLC(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.UpdateFailHTLC_free(ptr); }
23 public ChannelId get_channel_id() {
24 long ret = bindings.UpdateFailHTLC_get_channel_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
28 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
35 public void set_channel_id(org.ldk.structs.ChannelId val) {
36 bindings.UpdateFailHTLC_set_channel_id(this.ptr, val.ptr);
44 public long get_htlc_id() {
45 long ret = bindings.UpdateFailHTLC_get_htlc_id(this.ptr);
53 public void set_htlc_id(long val) {
54 bindings.UpdateFailHTLC_set_htlc_id(this.ptr, val);
59 internal long clone_ptr() {
60 long ret = bindings.UpdateFailHTLC_clone_ptr(this.ptr);
66 * Creates a copy of the UpdateFailHTLC
68 public UpdateFailHTLC clone() {
69 long ret = bindings.UpdateFailHTLC_clone(this.ptr);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.UpdateFailHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFailHTLC(null, ret); }
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
78 * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC.
81 long ret = bindings.UpdateFailHTLC_hash(this.ptr);
86 public override int GetHashCode() {
87 return (int)this.hash();
90 * Checks if two UpdateFailHTLCs contain equal inner contents.
91 * This ignores pointers and is_owned flags and looks at the values in fields.
92 * Two objects with NULL inner values will be considered "equal" here.
94 public bool eq(org.ldk.structs.UpdateFailHTLC b) {
95 bool ret = bindings.UpdateFailHTLC_eq(this.ptr, b.ptr);
98 if (this != null) { this.ptrs_to.AddLast(b); };
102 public override bool Equals(object o) {
103 if (!(o is UpdateFailHTLC)) return false;
104 return this.eq((UpdateFailHTLC)o);
107 * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
109 public byte[] write() {
110 long ret = bindings.UpdateFailHTLC_write(this.ptr);
112 if (ret >= 0 && ret <= 4096) { return null; }
113 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
118 * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
120 public static Result_UpdateFailHTLCDecodeErrorZ read(byte[] ser) {
121 long ret = bindings.UpdateFailHTLC_read(InternalUtils.encodeUint8Array(ser));
123 if (ret >= 0 && ret <= 4096) { return null; }
124 Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret);