6 namespace org { namespace ldk { namespace structs {
12 public class RouteHop : CommonBase {
13 internal RouteHop(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.RouteHop_free(ptr); }
19 * The node_id of the node at this hop.
21 public byte[] get_pubkey() {
22 byte[] ret = bindings.RouteHop_get_pubkey(this.ptr);
28 * The node_id of the node at this hop.
30 public void set_pubkey(byte[] val) {
31 bindings.RouteHop_set_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
37 * The node_announcement features of the node at this hop. For the last hop, these may be
38 * amended to match the features present in the invoice this node generated.
40 public NodeFeatures get_node_features() {
41 long ret = bindings.RouteHop_get_node_features(this.ptr);
43 if (ret >= 0 && ret <= 4096) { return null; }
44 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
45 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
50 * The node_announcement features of the node at this hop. For the last hop, these may be
51 * amended to match the features present in the invoice this node generated.
53 public void set_node_features(org.ldk.structs.NodeFeatures val) {
54 bindings.RouteHop_set_node_features(this.ptr, val == null ? 0 : val.ptr);
57 if (this != null) { this.ptrs_to.AddLast(val); };
61 * The channel that should be used from the previous hop to reach this node.
63 public long get_short_channel_id() {
64 long ret = bindings.RouteHop_get_short_channel_id(this.ptr);
70 * The channel that should be used from the previous hop to reach this node.
72 public void set_short_channel_id(long val) {
73 bindings.RouteHop_set_short_channel_id(this.ptr, val);
79 * The channel_announcement features of the channel that should be used from the previous hop
82 public ChannelFeatures get_channel_features() {
83 long ret = bindings.RouteHop_get_channel_features(this.ptr);
85 if (ret >= 0 && ret <= 4096) { return null; }
86 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
87 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
92 * The channel_announcement features of the channel that should be used from the previous hop
95 public void set_channel_features(org.ldk.structs.ChannelFeatures val) {
96 bindings.RouteHop_set_channel_features(this.ptr, val == null ? 0 : val.ptr);
99 if (this != null) { this.ptrs_to.AddLast(val); };
103 * The fee taken on this hop (for paying for the use of the *next* channel in the path).
104 * For the last hop, this should be the full value of the payment (might be more than
105 * requested if we had to match htlc_minimum_msat).
107 public long get_fee_msat() {
108 long ret = bindings.RouteHop_get_fee_msat(this.ptr);
114 * The fee taken on this hop (for paying for the use of the *next* channel in the path).
115 * For the last hop, this should be the full value of the payment (might be more than
116 * requested if we had to match htlc_minimum_msat).
118 public void set_fee_msat(long val) {
119 bindings.RouteHop_set_fee_msat(this.ptr, val);
125 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
126 * expected at the destination, in excess of the current block height.
128 public int get_cltv_expiry_delta() {
129 int ret = bindings.RouteHop_get_cltv_expiry_delta(this.ptr);
135 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
136 * expected at the destination, in excess of the current block height.
138 public void set_cltv_expiry_delta(int val) {
139 bindings.RouteHop_set_cltv_expiry_delta(this.ptr, val);
145 * Constructs a new RouteHop given each field
147 public static RouteHop of(byte[] pubkey_arg, org.ldk.structs.NodeFeatures node_features_arg, long short_channel_id_arg, org.ldk.structs.ChannelFeatures channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg) {
148 long ret = bindings.RouteHop_new(InternalUtils.check_arr_len(pubkey_arg, 33), node_features_arg == null ? 0 : node_features_arg.ptr, short_channel_id_arg, channel_features_arg == null ? 0 : channel_features_arg.ptr, fee_msat_arg, cltv_expiry_delta_arg);
149 GC.KeepAlive(pubkey_arg);
150 GC.KeepAlive(node_features_arg);
151 GC.KeepAlive(short_channel_id_arg);
152 GC.KeepAlive(channel_features_arg);
153 GC.KeepAlive(fee_msat_arg);
154 GC.KeepAlive(cltv_expiry_delta_arg);
155 if (ret >= 0 && ret <= 4096) { return null; }
156 org.ldk.structs.RouteHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHop(null, ret); }
157 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
158 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(node_features_arg); };
159 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_features_arg); };
163 internal long clone_ptr() {
164 long ret = bindings.RouteHop_clone_ptr(this.ptr);
170 * Creates a copy of the RouteHop
172 public RouteHop clone() {
173 long ret = bindings.RouteHop_clone(this.ptr);
175 if (ret >= 0 && ret <= 4096) { return null; }
176 org.ldk.structs.RouteHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHop(null, ret); }
177 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
182 * Checks if two RouteHops contain equal inner contents.
185 long ret = bindings.RouteHop_hash(this.ptr);
190 public override int GetHashCode() {
191 return (int)this.hash();
194 * Checks if two RouteHops contain equal inner contents.
195 * This ignores pointers and is_owned flags and looks at the values in fields.
196 * Two objects with NULL inner values will be considered "equal" here.
198 public bool eq(org.ldk.structs.RouteHop b) {
199 bool ret = bindings.RouteHop_eq(this.ptr, b == null ? 0 : b.ptr);
202 if (this != null) { this.ptrs_to.AddLast(b); };
206 public override bool Equals(object o) {
207 if (!(o is RouteHop)) return false;
208 return this.eq((RouteHop)o);
211 * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
213 public byte[] write() {
214 byte[] ret = bindings.RouteHop_write(this.ptr);
220 * Read a RouteHop from a byte array, created by RouteHop_write
222 public static Result_RouteHopDecodeErrorZ read(byte[] ser) {
223 long ret = bindings.RouteHop_read(ser);
225 if (ret >= 0 && ret <= 4096) { return null; }
226 Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret);