6 namespace org { namespace ldk { namespace structs {
10 * An [`update_fee`] message to be sent to or received from a peer
12 * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
14 public class UpdateFee : CommonBase {
15 internal UpdateFee(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.UpdateFee_free(ptr); }
23 public ChannelId get_channel_id() {
24 long ret = bindings.UpdateFee_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.UpdateFee_set_channel_id(this.ptr, val.ptr);
39 if (this != null) { this.ptrs_to.AddLast(val); };
43 * Fee rate per 1000-weight of the transaction
45 public int get_feerate_per_kw() {
46 int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
52 * Fee rate per 1000-weight of the transaction
54 public void set_feerate_per_kw(int val) {
55 bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
61 * Constructs a new UpdateFee given each field
63 public static UpdateFee of(org.ldk.structs.ChannelId channel_id_arg, int feerate_per_kw_arg) {
64 long ret = bindings.UpdateFee_new(channel_id_arg.ptr, feerate_per_kw_arg);
65 GC.KeepAlive(channel_id_arg);
66 GC.KeepAlive(feerate_per_kw_arg);
67 if (ret >= 0 && ret <= 4096) { return null; }
68 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
70 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
74 internal long clone_ptr() {
75 long ret = bindings.UpdateFee_clone_ptr(this.ptr);
81 * Creates a copy of the UpdateFee
83 public UpdateFee clone() {
84 long ret = bindings.UpdateFee_clone(this.ptr);
86 if (ret >= 0 && ret <= 4096) { return null; }
87 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
88 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
93 * Generates a non-cryptographic 64-bit hash of the UpdateFee.
96 long ret = bindings.UpdateFee_hash(this.ptr);
101 public override int GetHashCode() {
102 return (int)this.hash();
105 * Checks if two UpdateFees 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.UpdateFee b) {
110 bool ret = bindings.UpdateFee_eq(this.ptr, b.ptr);
113 if (this != null) { this.ptrs_to.AddLast(b); };
117 public override bool Equals(object o) {
118 if (!(o is UpdateFee)) return false;
119 return this.eq((UpdateFee)o);
122 * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
124 public byte[] write() {
125 long ret = bindings.UpdateFee_write(this.ptr);
127 if (ret >= 0 && ret <= 4096) { return null; }
128 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
133 * Read a UpdateFee from a byte array, created by UpdateFee_write
135 public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) {
136 long ret = bindings.UpdateFee_read(InternalUtils.encodeUint8Array(ser));
138 if (ret >= 0 && ret <= 4096) { return null; }
139 Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);