Skip to content

Commit 4a36fa9

Browse files
committed
[Java] Update auto-generated bindings to 0.0.115
1 parent 46763b9 commit 4a36fa9

File tree

96 files changed

+56027
-44198
lines changed

Some content is hidden

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

96 files changed

+56027
-44198
lines changed

src/main/java/org/ldk/enums/CreationError.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package org.ldk.enums;
22

33
/**
4-
* Errors that may occur when constructing a new `RawInvoice` or `Invoice`
4+
* Errors that may occur when constructing a new [`RawInvoice`] or [`Invoice`]
55
*/
66
public enum CreationError {
77
/**
8-
* The supplied description string was longer than 639 __bytes__ (see [`Description::new(...)`](./struct.Description.html#method.new))
8+
* The supplied description string was longer than 639 __bytes__ (see [`Description::new`])
99
*/
1010
LDKCreationError_DescriptionTooLong,
1111
/**
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package org.ldk.enums;
2+
3+
/**
4+
* The reason the payment failed. Used in [`Event::PaymentFailed`].
5+
*/
6+
public enum PaymentFailureReason {
7+
/**
8+
* The intended recipient rejected our payment.
9+
*/
10+
LDKPaymentFailureReason_RecipientRejected,
11+
/**
12+
* The user chose to abandon this payment by calling [`ChannelManager::abandon_payment`].
13+
*
14+
* [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
15+
*/
16+
LDKPaymentFailureReason_UserAbandoned,
17+
/**
18+
* We exhausted all of our retry attempts while trying to send the payment, or we
19+
* exhausted the [`Retry::Timeout`] if the user set one. If at any point a retry
20+
* attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will
21+
* have come before this.
22+
*
23+
* [`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout
24+
*/
25+
LDKPaymentFailureReason_RetriesExhausted,
26+
/**
27+
* The payment expired while retrying, based on the provided
28+
* [`PaymentParameters::expiry_time`].
29+
*
30+
* [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
31+
*/
32+
LDKPaymentFailureReason_PaymentExpired,
33+
/**
34+
* We failed to find a route while retrying the payment.
35+
*/
36+
LDKPaymentFailureReason_RouteNotFound,
37+
/**
38+
* This error should generally never happen. This likely means that there is a problem with
39+
* your router.
40+
*/
41+
LDKPaymentFailureReason_UnexpectedError,
42+
; static native void init();
43+
static { init(); }
44+
}

src/main/java/org/ldk/enums/RetryableSendFailure.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.ldk.enums;
22

33
/**
4-
* Indicates an immediate error on [`ChannelManager::send_payment_with_retry`]. Further errors
5-
* may be surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`].
4+
* Indicates an immediate error on [`ChannelManager::send_payment`]. Further errors may be
5+
* surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`].
66
*
7-
* [`ChannelManager::send_payment_with_retry`]: crate::ln::channelmanager::ChannelManager::send_payment_with_retry
8-
* [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
9-
* [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
7+
* [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
8+
* [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
9+
* [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
1010
*/
1111
public enum RetryableSendFailure {
1212
/**
@@ -25,8 +25,8 @@ public enum RetryableSendFailure {
2525
* yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
2626
*
2727
* [`PaymentId`]: crate::ln::channelmanager::PaymentId
28-
* [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent
29-
* [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
28+
* [`Event::PaymentSent`]: crate::events::Event::PaymentSent
29+
* [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
3030
*/
3131
LDKRetryableSendFailure_DuplicatePayment,
3232
; static native void init();

src/main/java/org/ldk/enums/SemanticError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.ldk.enums;
22

33
/**
4-
* Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
4+
* Errors that may occur when converting a [`RawInvoice`] to an [`Invoice`]. They relate to the
55
* requirements sections in BOLT #11
66
*/
77
public enum SemanticError {

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

Lines changed: 1397 additions & 838 deletions
Large diffs are not rendered by default.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
* The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or
13+
* another currency.
14+
*/
15+
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
16+
public class Amount extends CommonBase {
17+
Amount(Object _dummy, long ptr) { super(ptr); }
18+
@Override @SuppressWarnings("deprecation")
19+
protected void finalize() throws Throwable {
20+
super.finalize();
21+
if (ptr != 0) { bindings.Amount_free(ptr); }
22+
}
23+
24+
long clone_ptr() {
25+
long ret = bindings.Amount_clone_ptr(this.ptr);
26+
Reference.reachabilityFence(this);
27+
return ret;
28+
}
29+
30+
/**
31+
* Creates a copy of the Amount
32+
*/
33+
public Amount clone() {
34+
long ret = bindings.Amount_clone(this.ptr);
35+
Reference.reachabilityFence(this);
36+
if (ret >= 0 && ret <= 4096) { return null; }
37+
org.ldk.structs.Amount ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Amount(null, ret); }
38+
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
39+
return ret_hu_conv;
40+
}
41+
42+
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
1717
* writing it to disk/backups by invoking the callback given to it at startup.
1818
* [`ChannelManager`] persistence should be done in the background.
19-
* Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
20-
* at the appropriate intervals.
19+
* Calling [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`]
20+
* and [`PeerManager::timer_tick_occurred`] at the appropriate intervals.
2121
* Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
2222
* [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
2323
*
@@ -32,7 +32,7 @@
3232
* unilateral chain closure fees are at risk.
3333
*
3434
* [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
35-
* [`Event`]: lightning::util::events::Event
35+
* [`Event`]: lightning::events::Event
3636
* BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
3737
*/
3838
@SuppressWarnings("unchecked") // We correctly assign various generic arrays

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,35 @@ public BlindedHop clone() {
3939
return ret_hu_conv;
4040
}
4141

42+
/**
43+
* Generates a non-cryptographic 64-bit hash of the BlindedHop.
44+
*/
45+
public long hash() {
46+
long ret = bindings.BlindedHop_hash(this.ptr);
47+
Reference.reachabilityFence(this);
48+
return ret;
49+
}
50+
51+
@Override public int hashCode() {
52+
return (int)this.hash();
53+
}
54+
/**
55+
* Checks if two BlindedHops contain equal inner contents.
56+
* This ignores pointers and is_owned flags and looks at the values in fields.
57+
* Two objects with NULL inner values will be considered "equal" here.
58+
*/
59+
public boolean eq(org.ldk.structs.BlindedHop b) {
60+
boolean ret = bindings.BlindedHop_eq(this.ptr, b == null ? 0 : b.ptr);
61+
Reference.reachabilityFence(this);
62+
Reference.reachabilityFence(b);
63+
if (this != null) { this.ptrs_to.add(b); };
64+
return ret;
65+
}
66+
67+
@Override public boolean equals(Object o) {
68+
if (!(o instanceof BlindedHop)) return false;
69+
return this.eq((BlindedHop)o);
70+
}
4271
/**
4372
* Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
4473
*/

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

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010

1111
/**
12-
* Onion messages can be sent and received to blinded paths, which serve to hide the identity of
13-
* the recipient.
12+
* Onion messages and payments can be sent and received to blinded paths, which serve to hide the
13+
* identity of the recipient.
1414
*/
1515
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
1616
public class BlindedPath extends CommonBase {
@@ -40,13 +40,42 @@ public BlindedPath clone() {
4040
}
4141

4242
/**
43-
* Create a blinded path to be forwarded along `node_pks`. The last node pubkey in `node_pks`
44-
* will be the destination node.
43+
* Generates a non-cryptographic 64-bit hash of the BlindedPath.
44+
*/
45+
public long hash() {
46+
long ret = bindings.BlindedPath_hash(this.ptr);
47+
Reference.reachabilityFence(this);
48+
return ret;
49+
}
50+
51+
@Override public int hashCode() {
52+
return (int)this.hash();
53+
}
54+
/**
55+
* Checks if two BlindedPaths contain equal inner contents.
56+
* This ignores pointers and is_owned flags and looks at the values in fields.
57+
* Two objects with NULL inner values will be considered "equal" here.
58+
*/
59+
public boolean eq(org.ldk.structs.BlindedPath b) {
60+
boolean ret = bindings.BlindedPath_eq(this.ptr, b == null ? 0 : b.ptr);
61+
Reference.reachabilityFence(this);
62+
Reference.reachabilityFence(b);
63+
if (this != null) { this.ptrs_to.add(b); };
64+
return ret;
65+
}
66+
67+
@Override public boolean equals(Object o) {
68+
if (!(o instanceof BlindedPath)) return false;
69+
return this.eq((BlindedPath)o);
70+
}
71+
/**
72+
* Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
73+
* pubkey in `node_pks` will be the destination node.
4574
*
4675
* Errors if less than two hops are provided or if `node_pk`(s) are invalid.
4776
*/
48-
public static Result_BlindedPathNoneZ of(byte[][] node_pks, org.ldk.structs.EntropySource entropy_source) {
49-
long ret = bindings.BlindedPath_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, entropy_source == null ? 0 : entropy_source.ptr);
77+
public static Result_BlindedPathNoneZ new_for_message(byte[][] node_pks, org.ldk.structs.EntropySource entropy_source) {
78+
long ret = bindings.BlindedPath_new_for_message(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, entropy_source == null ? 0 : entropy_source.ptr);
5079
Reference.reachabilityFence(node_pks);
5180
Reference.reachabilityFence(entropy_source);
5281
if (ret >= 0 && ret <= 4096) { return null; }

0 commit comments

Comments
 (0)