[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / QueryChannelRange.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  * A [`query_channel_range`] message is used to query a peer for channel
11  * UTXOs in a range of blocks. The recipient of a query makes a best
12  * effort to reply to the query using one or more [`ReplyChannelRange`]
13  * messages.
14  * 
15  * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
16  */
17 public class QueryChannelRange : CommonBase {
18         internal QueryChannelRange(object _dummy, long ptr) : base(ptr) { }
19         ~QueryChannelRange() {
20                 if (ptr != 0) { bindings.QueryChannelRange_free(ptr); }
21         }
22
23         /**
24          * The genesis hash of the blockchain being queried
25          */
26         public byte[] get_chain_hash() {
27                 byte[] ret = bindings.QueryChannelRange_get_chain_hash(this.ptr);
28                 GC.KeepAlive(this);
29                 return ret;
30         }
31
32         /**
33          * The genesis hash of the blockchain being queried
34          */
35         public void set_chain_hash(byte[] val) {
36                 bindings.QueryChannelRange_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 GC.KeepAlive(this);
38                 GC.KeepAlive(val);
39         }
40
41         /**
42          * The height of the first block for the channel UTXOs being queried
43          */
44         public int get_first_blocknum() {
45                 int ret = bindings.QueryChannelRange_get_first_blocknum(this.ptr);
46                 GC.KeepAlive(this);
47                 return ret;
48         }
49
50         /**
51          * The height of the first block for the channel UTXOs being queried
52          */
53         public void set_first_blocknum(int val) {
54                 bindings.QueryChannelRange_set_first_blocknum(this.ptr, val);
55                 GC.KeepAlive(this);
56                 GC.KeepAlive(val);
57         }
58
59         /**
60          * The number of blocks to include in the query results
61          */
62         public int get_number_of_blocks() {
63                 int ret = bindings.QueryChannelRange_get_number_of_blocks(this.ptr);
64                 GC.KeepAlive(this);
65                 return ret;
66         }
67
68         /**
69          * The number of blocks to include in the query results
70          */
71         public void set_number_of_blocks(int val) {
72                 bindings.QueryChannelRange_set_number_of_blocks(this.ptr, val);
73                 GC.KeepAlive(this);
74                 GC.KeepAlive(val);
75         }
76
77         /**
78          * Constructs a new QueryChannelRange given each field
79          */
80         public static QueryChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg) {
81                 long ret = bindings.QueryChannelRange_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_blocknum_arg, number_of_blocks_arg);
82                 GC.KeepAlive(chain_hash_arg);
83                 GC.KeepAlive(first_blocknum_arg);
84                 GC.KeepAlive(number_of_blocks_arg);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 org.ldk.structs.QueryChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.QueryChannelRange(null, ret); }
87                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
88                 return ret_hu_conv;
89         }
90
91         internal long clone_ptr() {
92                 long ret = bindings.QueryChannelRange_clone_ptr(this.ptr);
93                 GC.KeepAlive(this);
94                 return ret;
95         }
96
97         /**
98          * Creates a copy of the QueryChannelRange
99          */
100         public QueryChannelRange clone() {
101                 long ret = bindings.QueryChannelRange_clone(this.ptr);
102                 GC.KeepAlive(this);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 org.ldk.structs.QueryChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.QueryChannelRange(null, ret); }
105                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
106                 return ret_hu_conv;
107         }
108
109         /**
110          * Checks if two QueryChannelRanges 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 bool eq(org.ldk.structs.QueryChannelRange b) {
115                 bool ret = bindings.QueryChannelRange_eq(this.ptr, b == null ? 0 : b.ptr);
116                 GC.KeepAlive(this);
117                 GC.KeepAlive(b);
118                 if (this != null) { this.ptrs_to.AddLast(b); };
119                 return ret;
120         }
121
122         public override bool Equals(object o) {
123                 if (!(o is QueryChannelRange)) return false;
124                 return this.eq((QueryChannelRange)o);
125         }
126         /**
127          * Calculates the overflow safe ending block height for the query.
128          * 
129          * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`.
130          */
131         public int end_blocknum() {
132                 int ret = bindings.QueryChannelRange_end_blocknum(this.ptr);
133                 GC.KeepAlive(this);
134                 return ret;
135         }
136
137         /**
138          * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
139          */
140         public byte[] write() {
141                 byte[] ret = bindings.QueryChannelRange_write(this.ptr);
142                 GC.KeepAlive(this);
143                 return ret;
144         }
145
146         /**
147          * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
148          */
149         public static Result_QueryChannelRangeDecodeErrorZ read(byte[] ser) {
150                 long ret = bindings.QueryChannelRange_read(ser);
151                 GC.KeepAlive(ser);
152                 if (ret >= 0 && ret <= 4096) { return null; }
153                 Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret);
154                 return ret_hu_conv;
155         }
156
157 }
158 } } }