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 byte[] get_channel_id() {
24 byte[] ret = bindings.UpdateFee_get_channel_id(this.ptr);
32 public void set_channel_id(byte[] val) {
33 bindings.UpdateFee_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39 * Fee rate per 1000-weight of the transaction
41 public int get_feerate_per_kw() {
42 int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
48 * Fee rate per 1000-weight of the transaction
50 public void set_feerate_per_kw(int val) {
51 bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
57 * Constructs a new UpdateFee given each field
59 public static UpdateFee of(byte[] channel_id_arg, int feerate_per_kw_arg) {
60 long ret = bindings.UpdateFee_new(InternalUtils.check_arr_len(channel_id_arg, 32), feerate_per_kw_arg);
61 GC.KeepAlive(channel_id_arg);
62 GC.KeepAlive(feerate_per_kw_arg);
63 if (ret >= 0 && ret <= 4096) { return null; }
64 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
65 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
69 internal long clone_ptr() {
70 long ret = bindings.UpdateFee_clone_ptr(this.ptr);
76 * Creates a copy of the UpdateFee
78 public UpdateFee clone() {
79 long ret = bindings.UpdateFee_clone(this.ptr);
81 if (ret >= 0 && ret <= 4096) { return null; }
82 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
83 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
88 * Checks if two UpdateFees contain equal inner contents.
89 * This ignores pointers and is_owned flags and looks at the values in fields.
90 * Two objects with NULL inner values will be considered "equal" here.
92 public bool eq(org.ldk.structs.UpdateFee b) {
93 bool ret = bindings.UpdateFee_eq(this.ptr, b == null ? 0 : b.ptr);
96 if (this != null) { this.ptrs_to.AddLast(b); };
100 public override bool Equals(object o) {
101 if (!(o is UpdateFee)) return false;
102 return this.eq((UpdateFee)o);
105 * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
107 public byte[] write() {
108 byte[] ret = bindings.UpdateFee_write(this.ptr);
114 * Read a UpdateFee from a byte array, created by UpdateFee_write
116 public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) {
117 long ret = bindings.UpdateFee_read(ser);
119 if (ret >= 0 && ret <= 4096) { return null; }
120 Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);