]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/UpdateFailHTLC.cs
[C#] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / c_sharp / src / org / ldk / structs / UpdateFailHTLC.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * An [`update_fail_htlc`] message to be sent to or received from a peer.
11  * 
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
13  */
14 public class UpdateFailHTLC : CommonBase {
15         internal UpdateFailHTLC(object _dummy, long ptr) : base(ptr) { }
16         ~UpdateFailHTLC() {
17                 if (ptr != 0) { bindings.UpdateFailHTLC_free(ptr); }
18         }
19
20         /**
21          * The channel ID
22          */
23         public ChannelId get_channel_id() {
24                 long ret = bindings.UpdateFailHTLC_get_channel_id(this.ptr);
25                 GC.KeepAlive(this);
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); };
29                 return ret_hu_conv;
30         }
31
32         /**
33          * The channel ID
34          */
35         public void set_channel_id(org.ldk.structs.ChannelId val) {
36                 bindings.UpdateFailHTLC_set_channel_id(this.ptr, val.ptr);
37                 GC.KeepAlive(this);
38                 GC.KeepAlive(val);
39                 if (this != null) { this.ptrs_to.AddLast(val); };
40         }
41
42         /**
43          * The HTLC ID
44          */
45         public long get_htlc_id() {
46                 long ret = bindings.UpdateFailHTLC_get_htlc_id(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * The HTLC ID
53          */
54         public void set_htlc_id(long val) {
55                 bindings.UpdateFailHTLC_set_htlc_id(this.ptr, val);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         internal long clone_ptr() {
61                 long ret = bindings.UpdateFailHTLC_clone_ptr(this.ptr);
62                 GC.KeepAlive(this);
63                 return ret;
64         }
65
66         /**
67          * Creates a copy of the UpdateFailHTLC
68          */
69         public UpdateFailHTLC clone() {
70                 long ret = bindings.UpdateFailHTLC_clone(this.ptr);
71                 GC.KeepAlive(this);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.UpdateFailHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFailHTLC(null, ret); }
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
75                 return ret_hu_conv;
76         }
77
78         /**
79          * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC.
80          */
81         public long hash() {
82                 long ret = bindings.UpdateFailHTLC_hash(this.ptr);
83                 GC.KeepAlive(this);
84                 return ret;
85         }
86
87         public override int GetHashCode() {
88                 return (int)this.hash();
89         }
90         /**
91          * Checks if two UpdateFailHTLCs contain equal inner contents.
92          * This ignores pointers and is_owned flags and looks at the values in fields.
93          * Two objects with NULL inner values will be considered "equal" here.
94          */
95         public bool eq(org.ldk.structs.UpdateFailHTLC b) {
96                 bool ret = bindings.UpdateFailHTLC_eq(this.ptr, b.ptr);
97                 GC.KeepAlive(this);
98                 GC.KeepAlive(b);
99                 if (this != null) { this.ptrs_to.AddLast(b); };
100                 return ret;
101         }
102
103         public override bool Equals(object o) {
104                 if (!(o is UpdateFailHTLC)) return false;
105                 return this.eq((UpdateFailHTLC)o);
106         }
107         /**
108          * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
109          */
110         public byte[] write() {
111                 long ret = bindings.UpdateFailHTLC_write(this.ptr);
112                 GC.KeepAlive(this);
113                 if (ret >= 0 && ret <= 4096) { return null; }
114                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
115                 return ret_conv;
116         }
117
118         /**
119          * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
120          */
121         public static Result_UpdateFailHTLCDecodeErrorZ read(byte[] ser) {
122                 long ret = bindings.UpdateFailHTLC_read(InternalUtils.encodeUint8Array(ser));
123                 GC.KeepAlive(ser);
124                 if (ret >= 0 && ret <= 4096) { return null; }
125                 Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret);
126                 return ret_hu_conv;
127         }
128
129 }
130 } } }