Skip to content

Commit 76982ad

Browse files
committed
[Java] Update auto-generated Java files
1 parent 227672a commit 76982ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+11192
-2295
lines changed

src/main/java/org/ldk/impl/bindings.java

Lines changed: 485 additions & 99 deletions
Large diffs are not rendered by default.

src/main/java/org/ldk/structs/BackgroundProcessor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,9 @@ protected void finalize() throws Throwable {
8989
* [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
9090
* [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
9191
* [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
92-
*
93-
* Note that scorer (or a relevant inner pointer) may be NULL or all-0s to represent None
9492
*/
95-
public static BackgroundProcessor start(Persister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, GossipSync gossip_sync, PeerManager peer_manager, Logger logger, @Nullable MultiThreadedLockableScore scorer) {
96-
long ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, channel_manager == null ? 0 : channel_manager.ptr, gossip_sync.ptr, peer_manager == null ? 0 : peer_manager.ptr, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr);
93+
public static BackgroundProcessor start(Persister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, GossipSync gossip_sync, PeerManager peer_manager, Logger logger, Option_WriteableScoreZ scorer) {
94+
long ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, channel_manager == null ? 0 : channel_manager.ptr, gossip_sync.ptr, peer_manager == null ? 0 : peer_manager.ptr, logger == null ? 0 : logger.ptr, scorer.ptr);
9795
Reference.reachabilityFence(persister);
9896
Reference.reachabilityFence(event_handler);
9997
Reference.reachabilityFence(chain_monitor);

src/main/java/org/ldk/structs/Balance.java

Lines changed: 82 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ static Balance constr_from_ptr(long ptr) {
3333
if (raw_val.getClass() == bindings.LDKBalance.ContentiousClaimable.class) {
3434
return new ContentiousClaimable(ptr, (bindings.LDKBalance.ContentiousClaimable)raw_val);
3535
}
36-
if (raw_val.getClass() == bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout.class) {
37-
return new MaybeClaimableHTLCAwaitingTimeout(ptr, (bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout)raw_val);
36+
if (raw_val.getClass() == bindings.LDKBalance.MaybeTimeoutClaimableHTLC.class) {
37+
return new MaybeTimeoutClaimableHTLC(ptr, (bindings.LDKBalance.MaybeTimeoutClaimableHTLC)raw_val);
38+
}
39+
if (raw_val.getClass() == bindings.LDKBalance.MaybePreimageClaimableHTLC.class) {
40+
return new MaybePreimageClaimableHTLC(ptr, (bindings.LDKBalance.MaybePreimageClaimableHTLC)raw_val);
41+
}
42+
if (raw_val.getClass() == bindings.LDKBalance.CounterpartyRevokedOutputClaimable.class) {
43+
return new CounterpartyRevokedOutputClaimable(ptr, (bindings.LDKBalance.CounterpartyRevokedOutputClaimable)raw_val);
3844
}
3945
assert false; return null; // Unreachable without extending the (internal) bindings interface
4046
}
@@ -107,23 +113,65 @@ private ContentiousClaimable(long ptr, bindings.LDKBalance.ContentiousClaimable
107113
* fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
108114
* likely to be claimed by our counterparty before we do.
109115
*/
110-
public final static class MaybeClaimableHTLCAwaitingTimeout extends Balance {
116+
public final static class MaybeTimeoutClaimableHTLC extends Balance {
111117
/**
112-
* The amount available to claim, in satoshis, excluding the on-chain fees which will be
113-
* required to do so.
118+
* The amount potentially available to claim, in satoshis, excluding the on-chain fees
119+
* which will be required to do so.
114120
*/
115121
public final long claimable_amount_satoshis;
116122
/**
117123
* The height at which we will be able to claim the balance if our counterparty has not
118124
* done so.
119125
*/
120126
public final int claimable_height;
121-
private MaybeClaimableHTLCAwaitingTimeout(long ptr, bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout obj) {
127+
private MaybeTimeoutClaimableHTLC(long ptr, bindings.LDKBalance.MaybeTimeoutClaimableHTLC obj) {
122128
super(null, ptr);
123129
this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
124130
this.claimable_height = obj.claimable_height;
125131
}
126132
}
133+
/**
134+
* HTLCs which we received from our counterparty which are claimable with a preimage which we
135+
* do not currently have. This will only be claimable if we receive the preimage from the node
136+
* to which we forwarded this HTLC before the timeout.
137+
*/
138+
public final static class MaybePreimageClaimableHTLC extends Balance {
139+
/**
140+
* The amount potentially available to claim, in satoshis, excluding the on-chain fees
141+
* which will be required to do so.
142+
*/
143+
public final long claimable_amount_satoshis;
144+
/**
145+
* The height at which our counterparty will be able to claim the balance if we have not
146+
* yet received the preimage and claimed it ourselves.
147+
*/
148+
public final int expiry_height;
149+
private MaybePreimageClaimableHTLC(long ptr, bindings.LDKBalance.MaybePreimageClaimableHTLC obj) {
150+
super(null, ptr);
151+
this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
152+
this.expiry_height = obj.expiry_height;
153+
}
154+
}
155+
/**
156+
* The channel has been closed, and our counterparty broadcasted a revoked commitment
157+
* transaction.
158+
*
159+
* Thus, we're able to claim all outputs in the commitment transaction, one of which has the
160+
* following amount.
161+
*/
162+
public final static class CounterpartyRevokedOutputClaimable extends Balance {
163+
/**
164+
* The amount, in satoshis, of the output which we can claim.
165+
*
166+
* Note that for outputs from HTLC balances this may be excluding some on-chain fees that
167+
* were already spent.
168+
*/
169+
public final long claimable_amount_satoshis;
170+
private CounterpartyRevokedOutputClaimable(long ptr, bindings.LDKBalance.CounterpartyRevokedOutputClaimable obj) {
171+
super(null, ptr);
172+
this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
173+
}
174+
}
127175
long clone_ptr() {
128176
long ret = bindings.Balance_clone_ptr(this.ptr);
129177
Reference.reachabilityFence(this);
@@ -181,10 +229,10 @@ public static Balance contentious_claimable(long claimable_amount_satoshis, int
181229
}
182230

183231
/**
184-
* Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
232+
* Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
185233
*/
186-
public static Balance maybe_claimable_htlcawaiting_timeout(long claimable_amount_satoshis, int claimable_height) {
187-
long ret = bindings.Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
234+
public static Balance maybe_timeout_claimable_htlc(long claimable_amount_satoshis, int claimable_height) {
235+
long ret = bindings.Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
188236
Reference.reachabilityFence(claimable_amount_satoshis);
189237
Reference.reachabilityFence(claimable_height);
190238
if (ret >= 0 && ret <= 4096) { return null; }
@@ -193,6 +241,31 @@ public static Balance maybe_claimable_htlcawaiting_timeout(long claimable_amount
193241
return ret_hu_conv;
194242
}
195243

244+
/**
245+
* Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
246+
*/
247+
public static Balance maybe_preimage_claimable_htlc(long claimable_amount_satoshis, int expiry_height) {
248+
long ret = bindings.Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
249+
Reference.reachabilityFence(claimable_amount_satoshis);
250+
Reference.reachabilityFence(expiry_height);
251+
if (ret >= 0 && ret <= 4096) { return null; }
252+
org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret);
253+
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
254+
return ret_hu_conv;
255+
}
256+
257+
/**
258+
* Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
259+
*/
260+
public static Balance counterparty_revoked_output_claimable(long claimable_amount_satoshis) {
261+
long ret = bindings.Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
262+
Reference.reachabilityFence(claimable_amount_satoshis);
263+
if (ret >= 0 && ret <= 4096) { return null; }
264+
org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret);
265+
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
266+
return ret_hu_conv;
267+
}
268+
196269
/**
197270
* Checks if two Balances contain equal inner contents.
198271
* This ignores pointers and is_owned flags and looks at the values in fields.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
public class BigEndianScalar extends CommonBase {
11+
/** The bytes of the scalar value, in big endian */
12+
public final byte[] scalar_bytes;
13+
14+
BigEndianScalar(java.lang.Object _dummy, long ptr) {
15+
super(ptr);
16+
this.scalar_bytes = bindings.BigEndianScalar_get_bytes(ptr);
17+
}
18+
public BigEndianScalar(byte[] scalar_bytes) {
19+
super(bindings.BigEndianScalar_new(scalar_bytes));
20+
this.scalar_bytes = bindings.BigEndianScalar_get_bytes(ptr);
21+
}
22+
23+
@Override @SuppressWarnings("deprecation")
24+
protected void finalize() throws Throwable {
25+
super.finalize();
26+
if (ptr != 0) { bindings.BigEndianScalar_free(ptr); }
27+
}
28+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
* Used to construct the blinded hops portion of a blinded route. These hops cannot be identified
13+
* by outside observers and thus can be used to hide the identity of the recipient.
14+
*/
15+
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
16+
public class BlindedHop extends CommonBase {
17+
BlindedHop(Object _dummy, long ptr) { super(ptr); }
18+
@Override @SuppressWarnings("deprecation")
19+
protected void finalize() throws Throwable {
20+
super.finalize();
21+
if (ptr != 0) { bindings.BlindedHop_free(ptr); }
22+
}
23+
24+
/**
25+
* Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
26+
*/
27+
public byte[] write() {
28+
byte[] ret = bindings.BlindedHop_write(this.ptr);
29+
Reference.reachabilityFence(this);
30+
return ret;
31+
}
32+
33+
/**
34+
* Read a BlindedHop from a byte array, created by BlindedHop_write
35+
*/
36+
public static Result_BlindedHopDecodeErrorZ read(byte[] ser) {
37+
long ret = bindings.BlindedHop_read(ser);
38+
Reference.reachabilityFence(ser);
39+
if (ret >= 0 && ret <= 4096) { return null; }
40+
Result_BlindedHopDecodeErrorZ ret_hu_conv = Result_BlindedHopDecodeErrorZ.constr_from_ptr(ret);
41+
return ret_hu_conv;
42+
}
43+
44+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
* Onion messages can be sent and received to blinded routes, which serve to hide the identity of
13+
* the recipient.
14+
*/
15+
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
16+
public class BlindedRoute extends CommonBase {
17+
BlindedRoute(Object _dummy, long ptr) { super(ptr); }
18+
@Override @SuppressWarnings("deprecation")
19+
protected void finalize() throws Throwable {
20+
super.finalize();
21+
if (ptr != 0) { bindings.BlindedRoute_free(ptr); }
22+
}
23+
24+
/**
25+
* Create a blinded route to be forwarded along `node_pks`. The last node pubkey in `node_pks`
26+
* will be the destination node.
27+
*
28+
* Errors if less than two hops are provided or if `node_pk`(s) are invalid.
29+
*/
30+
public static Result_BlindedRouteNoneZ of(byte[][] node_pks, KeysInterface keys_manager) {
31+
long ret = bindings.BlindedRoute_new(node_pks != null ? Arrays.stream(node_pks).map(node_pks_conv_8 -> InternalUtils.check_arr_len(node_pks_conv_8, 33)).toArray(byte[][]::new) : null, keys_manager == null ? 0 : keys_manager.ptr);
32+
Reference.reachabilityFence(node_pks);
33+
Reference.reachabilityFence(keys_manager);
34+
if (ret >= 0 && ret <= 4096) { return null; }
35+
Result_BlindedRouteNoneZ ret_hu_conv = Result_BlindedRouteNoneZ.constr_from_ptr(ret);
36+
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
37+
return ret_hu_conv;
38+
}
39+
40+
/**
41+
* Serialize the BlindedRoute object into a byte array which can be read by BlindedRoute_read
42+
*/
43+
public byte[] write() {
44+
byte[] ret = bindings.BlindedRoute_write(this.ptr);
45+
Reference.reachabilityFence(this);
46+
return ret;
47+
}
48+
49+
/**
50+
* Read a BlindedRoute from a byte array, created by BlindedRoute_write
51+
*/
52+
public static Result_BlindedRouteDecodeErrorZ read(byte[] ser) {
53+
long ret = bindings.BlindedRoute_read(ser);
54+
Reference.reachabilityFence(ser);
55+
if (ret >= 0 && ret <= 4096) { return null; }
56+
Result_BlindedRouteDecodeErrorZ ret_hu_conv = Result_BlindedRouteDecodeErrorZ.constr_from_ptr(ret);
57+
return ret_hu_conv;
58+
}
59+
60+
}

src/main/java/org/ldk/structs/ChannelHandshakeConfig.java

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,79 @@ public void set_commit_upfront_shutdown_pubkey(boolean val) {
336336
Reference.reachabilityFence(val);
337337
}
338338

339+
/**
340+
* The Proportion of the channel value to configure as counterparty's channel reserve,
341+
* i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
342+
*
343+
* `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
344+
* on their side, at all times.
345+
* This ensures that if our counterparty broadcasts a revoked state, we can punish them by
346+
* claiming at least this value on chain.
347+
*
348+
* Channel reserve values greater than 30% could be considered highly unreasonable, since that
349+
* amount can never be used for payments.
350+
* Also, if our selected channel reserve for counterparty and counterparty's selected
351+
* channel reserve for us sum up to equal or greater than channel value, channel negotiations
352+
* will fail.
353+
*
354+
* Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
355+
* other than the default value.
356+
*
357+
* Default value: 1% of channel value, i.e., configured as 10,000 millionths.
358+
* Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
359+
* as 1000 sats instead, which is a safe implementation-specific lower bound.
360+
* Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
361+
* instead, although channel negotiations will fail in that case.
362+
*/
363+
public int get_their_channel_reserve_proportional_millionths() {
364+
int ret = bindings.ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(this.ptr);
365+
Reference.reachabilityFence(this);
366+
return ret;
367+
}
368+
369+
/**
370+
* The Proportion of the channel value to configure as counterparty's channel reserve,
371+
* i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
372+
*
373+
* `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
374+
* on their side, at all times.
375+
* This ensures that if our counterparty broadcasts a revoked state, we can punish them by
376+
* claiming at least this value on chain.
377+
*
378+
* Channel reserve values greater than 30% could be considered highly unreasonable, since that
379+
* amount can never be used for payments.
380+
* Also, if our selected channel reserve for counterparty and counterparty's selected
381+
* channel reserve for us sum up to equal or greater than channel value, channel negotiations
382+
* will fail.
383+
*
384+
* Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
385+
* other than the default value.
386+
*
387+
* Default value: 1% of channel value, i.e., configured as 10,000 millionths.
388+
* Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
389+
* as 1000 sats instead, which is a safe implementation-specific lower bound.
390+
* Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
391+
* instead, although channel negotiations will fail in that case.
392+
*/
393+
public void set_their_channel_reserve_proportional_millionths(int val) {
394+
bindings.ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(this.ptr, val);
395+
Reference.reachabilityFence(this);
396+
Reference.reachabilityFence(val);
397+
}
398+
339399
/**
340400
* Constructs a new ChannelHandshakeConfig given each field
341401
*/
342-
public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg, byte max_inbound_htlc_value_in_flight_percent_of_channel_arg, boolean negotiate_scid_privacy_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) {
343-
long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
402+
public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg, byte max_inbound_htlc_value_in_flight_percent_of_channel_arg, boolean negotiate_scid_privacy_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg, int their_channel_reserve_proportional_millionths_arg) {
403+
long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths_arg);
344404
Reference.reachabilityFence(minimum_depth_arg);
345405
Reference.reachabilityFence(our_to_self_delay_arg);
346406
Reference.reachabilityFence(our_htlc_minimum_msat_arg);
347407
Reference.reachabilityFence(max_inbound_htlc_value_in_flight_percent_of_channel_arg);
348408
Reference.reachabilityFence(negotiate_scid_privacy_arg);
349409
Reference.reachabilityFence(announced_channel_arg);
350410
Reference.reachabilityFence(commit_upfront_shutdown_pubkey_arg);
411+
Reference.reachabilityFence(their_channel_reserve_proportional_millionths_arg);
351412
if (ret >= 0 && ret <= 4096) { return null; }
352413
org.ldk.structs.ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeConfig(null, ret); }
353414
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };

0 commit comments

Comments
 (0)