[C#] Run tests against release library in determinism CI run
[ldk-java] / src / main / java / org / ldk / structs / UpdateFee.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * An [`update_fee`] message to be sent to or received from a peer
13  * 
14  * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class UpdateFee extends CommonBase {
18         UpdateFee(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.UpdateFee_free(ptr); }
23         }
24
25         /**
26          * The channel ID
27          */
28         public ChannelId get_channel_id() {
29                 long ret = bindings.UpdateFee_get_channel_id(this.ptr);
30                 Reference.reachabilityFence(this);
31                 if (ret >= 0 && ret <= 4096) { return null; }
32                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
33                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
34                 return ret_hu_conv;
35         }
36
37         /**
38          * The channel ID
39          */
40         public void set_channel_id(org.ldk.structs.ChannelId val) {
41                 bindings.UpdateFee_set_channel_id(this.ptr, val.ptr);
42                 Reference.reachabilityFence(this);
43                 Reference.reachabilityFence(val);
44                 if (this != null) { this.ptrs_to.add(val); };
45         }
46
47         /**
48          * Fee rate per 1000-weight of the transaction
49          */
50         public int get_feerate_per_kw() {
51                 int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
52                 Reference.reachabilityFence(this);
53                 return ret;
54         }
55
56         /**
57          * Fee rate per 1000-weight of the transaction
58          */
59         public void set_feerate_per_kw(int val) {
60                 bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(val);
63         }
64
65         /**
66          * Constructs a new UpdateFee given each field
67          */
68         public static UpdateFee of(org.ldk.structs.ChannelId channel_id_arg, int feerate_per_kw_arg) {
69                 long ret = bindings.UpdateFee_new(channel_id_arg.ptr, feerate_per_kw_arg);
70                 Reference.reachabilityFence(channel_id_arg);
71                 Reference.reachabilityFence(feerate_per_kw_arg);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
76                 return ret_hu_conv;
77         }
78
79         long clone_ptr() {
80                 long ret = bindings.UpdateFee_clone_ptr(this.ptr);
81                 Reference.reachabilityFence(this);
82                 return ret;
83         }
84
85         /**
86          * Creates a copy of the UpdateFee
87          */
88         public UpdateFee clone() {
89                 long ret = bindings.UpdateFee_clone(this.ptr);
90                 Reference.reachabilityFence(this);
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
93                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
94                 return ret_hu_conv;
95         }
96
97         /**
98          * Generates a non-cryptographic 64-bit hash of the UpdateFee.
99          */
100         public long hash() {
101                 long ret = bindings.UpdateFee_hash(this.ptr);
102                 Reference.reachabilityFence(this);
103                 return ret;
104         }
105
106         @Override public int hashCode() {
107                 return (int)this.hash();
108         }
109         /**
110          * Checks if two UpdateFees contain equal inner contents.
111          * This ignores pointers and is_owned flags and looks at the values in fields.
112          * Two objects with NULL inner values will be considered "equal" here.
113          */
114         public boolean eq(org.ldk.structs.UpdateFee b) {
115                 boolean ret = bindings.UpdateFee_eq(this.ptr, b.ptr);
116                 Reference.reachabilityFence(this);
117                 Reference.reachabilityFence(b);
118                 if (this != null) { this.ptrs_to.add(b); };
119                 return ret;
120         }
121
122         @Override public boolean equals(Object o) {
123                 if (!(o instanceof UpdateFee)) return false;
124                 return this.eq((UpdateFee)o);
125         }
126         /**
127          * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
128          */
129         public byte[] write() {
130                 byte[] ret = bindings.UpdateFee_write(this.ptr);
131                 Reference.reachabilityFence(this);
132                 return ret;
133         }
134
135         /**
136          * Read a UpdateFee from a byte array, created by UpdateFee_write
137          */
138         public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) {
139                 long ret = bindings.UpdateFee_read(ser);
140                 Reference.reachabilityFence(ser);
141                 if (ret >= 0 && ret <= 4096) { return null; }
142                 Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);
143                 return ret_hu_conv;
144         }
145
146 }