ldk-java
2 years agoHandle Java exceptions thrown in calls from C, printing and aborting v0.0.98.3
Matt Corallo [Tue, 22 Jun 2021 21:55:12 +0000 (21:55 +0000)]
Handle Java exceptions thrown in calls from C, printing and aborting

Closes #23.

2 years agoSupport glibc versions prior to 2.18 for linux builds
Matt Corallo [Tue, 22 Jun 2021 21:47:35 +0000 (21:47 +0000)]
Support glibc versions prior to 2.18 for linux builds

2 years agoRe-generate auto-generated bindings + add Mac OS generated bindings
Matt Corallo [Tue, 15 Jun 2021 23:18:12 +0000 (23:18 +0000)]
Re-generate auto-generated bindings + add Mac OS generated bindings

2 years agoDrop the liblightningjni link, creating it in CI instead v0.0.98.2
Matt Corallo [Tue, 15 Jun 2021 23:17:53 +0000 (23:17 +0000)]
Drop the liblightningjni link, creating it in CI instead

2 years agoAdd a CI run on OSX
Matt Corallo [Tue, 15 Jun 2021 19:55:19 +0000 (19:55 +0000)]
Add a CI run on OSX

2 years agoBuild a test jar which we can run to test the built jar is runnable
Matt Corallo [Tue, 15 Jun 2021 22:02:19 +0000 (22:02 +0000)]
Build a test jar which we can run to test the built jar is runnable

2 years agoInclude native libraries in jar by shifting folder structure
Matt Corallo [Tue, 15 Jun 2021 21:07:25 +0000 (21:07 +0000)]
Include native libraries in jar by shifting folder structure

2 years agoDrop most instances of Thread.sleep in HumanObjectPeerTest
Matt Corallo [Wed, 16 Jun 2021 01:57:45 +0000 (01:57 +0000)]
Drop most instances of Thread.sleep in HumanObjectPeerTest

2 years agoDo not rely on assertions being enabled in ChannelManagerConstructor
Matt Corallo [Wed, 16 Jun 2021 00:14:30 +0000 (00:14 +0000)]
Do not rely on assertions being enabled in ChannelManagerConstructor

2 years agoUpdate README with notes about OSX addrsan
Matt [Mon, 14 Jun 2021 22:30:43 +0000 (18:30 -0400)]
Update README with notes about OSX addrsan

2 years agoAdjust compile flags for OSX, set trace on genbindings.sh
Matt Corallo [Mon, 14 Jun 2021 21:12:54 +0000 (21:12 +0000)]
Adjust compile flags for OSX, set trace on genbindings.sh

2 years agoSkip manual leak checking on OSX as -Wl,-wrap is too complicated
Matt Corallo [Mon, 14 Jun 2021 21:09:55 +0000 (21:09 +0000)]
Skip manual leak checking on OSX as -Wl,-wrap is too complicated

2 years agoSupport OSX (ie builds where int64_t is not an alias for jlong)
Matt Corallo [Mon, 14 Jun 2021 19:51:41 +0000 (19:51 +0000)]
Support OSX (ie builds where int64_t is not an alias for jlong)

2 years agoDrop _test_only_get_ptr as it is no longer used
Matt Corallo [Sat, 12 Jun 2021 21:47:48 +0000 (21:47 +0000)]
Drop _test_only_get_ptr as it is no longer used

2 years agoUpdate auto-generated bindings with new release tag
Matt Corallo [Sat, 12 Jun 2021 17:03:04 +0000 (17:03 +0000)]
Update auto-generated bindings with new release tag

2 years agoAvoid use of covariant return type change fns fixing backwards compat v0.0.98.1
Matt Corallo [Sat, 12 Jun 2021 16:51:02 +0000 (16:51 +0000)]
Avoid use of covariant return type change fns fixing backwards compat

See, eg, https://jira.mongodb.org/browse/JAVA-2559. This results
in errors like the following:

```
2021-06-12 17:15:58.893 13340-13412/com.example.rnldk E/AndroidRuntime: FATAL EXCEPTION: NioPeerHandler NIO Thread
    Process: com.example.rnldk, PID: 13340
    java.lang.NoSuchMethodError: No virtual method clear()Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer; or its super classes (declaration of 'java.nio.ByteBuffer' appears in /system/framework/core-oj.jar)
        at org.ldk.batteries.NioPeerHandler.lambda$new$0$NioPeerHandler(NioPeerHandler.java:185)
        at org.ldk.batteries.-$$Lambda$NioPeerHandler$f9v_DKRzmlYYXidLTlb3OtA-tVY.run(Unknown Source:2)
        at java.lang.Thread.run(Thread.java:764)
```

2 years agoDo not cast JavaEnv to void** for AttachCurrentThread on Android
Matt Corallo [Sat, 12 Jun 2021 16:50:21 +0000 (16:50 +0000)]
Do not cast JavaEnv to void** for AttachCurrentThread on Android

2 years agoBetter support alternative targets in genbindings.sh
Matt Corallo [Sat, 12 Jun 2021 16:50:05 +0000 (16:50 +0000)]
Better support alternative targets in genbindings.sh

2 years agoMerge pull request #20 from TheBlueMatt/main v0.0.98
Matt Corallo [Fri, 11 Jun 2021 22:00:57 +0000 (22:00 +0000)]
Merge pull request #20 from TheBlueMatt/main

Update auto-generated bindings with missed files and v0.0.98 tags

2 years agoUpdate auto-generated bindings with missed files and v0.0.98 tags
Matt Corallo [Fri, 11 Jun 2021 21:20:59 +0000 (21:20 +0000)]
Update auto-generated bindings with missed files and v0.0.98 tags

2 years agoMerge pull request #18 from TheBlueMatt/main
Matt Corallo [Fri, 11 Jun 2021 21:08:33 +0000 (21:08 +0000)]
Merge pull request #18 from TheBlueMatt/main

Update to latest upstream C bindings with Invoice support

2 years agoUpdate auto-generated bindings
Matt Corallo [Mon, 7 Jun 2021 21:08:21 +0000 (21:08 +0000)]
Update auto-generated bindings

2 years agoForce CPU target to Sandy Bridge when compiling
Matt Corallo [Wed, 9 Jun 2021 01:48:07 +0000 (01:48 +0000)]
Force CPU target to Sandy Bridge when compiling

See the similar commit on ldk-c-bindings for more info.

2 years agoUse newly-exposed get_route in HumanObjectPeerTest
Matt Corallo [Mon, 7 Jun 2021 21:16:17 +0000 (21:16 +0000)]
Use newly-exposed get_route in HumanObjectPeerTest

2 years agoUpdate CI to not require git tags checked in and fix WASM32 paths.
Matt Corallo [Sun, 2 May 2021 22:34:52 +0000 (22:34 +0000)]
Update CI to not require git tags checked in and fix WASM32 paths.

2 years agoAvoid git version always appearing as dirty
Matt Corallo [Mon, 7 Jun 2021 20:38:52 +0000 (20:38 +0000)]
Avoid git version always appearing as dirty

2 years agoUpdate tests and Constructor to new APIs
Matt Corallo [Mon, 7 Jun 2021 03:19:07 +0000 (03:19 +0000)]
Update tests and Constructor to new APIs

2 years agoExpand the list of things exposed via UtilMethods
Matt Corallo [Mon, 7 Jun 2021 03:17:12 +0000 (03:17 +0000)]
Expand the list of things exposed via UtilMethods

2 years agoDrop the "LDK" prefix from unitary enums
Matt Corallo [Mon, 7 Jun 2021 03:16:53 +0000 (03:16 +0000)]
Drop the "LDK" prefix from unitary enums

2 years agoExpand and update ChannelManagerConstructor+tests for BP and Event API
Matt Corallo [Sat, 5 Jun 2021 17:06:31 +0000 (17:06 +0000)]
Expand and update ChannelManagerConstructor+tests for BP and Event API

2 years agoHandle methods taking non-ref self by using standard conversion
Matt Corallo [Sat, 5 Jun 2021 16:49:20 +0000 (16:49 +0000)]
Handle methods taking non-ref self by using standard conversion

2 years agoHandle C -> Java calls from Rust-spawned threads
Matt Corallo [Wed, 2 Jun 2021 19:26:42 +0000 (19:26 +0000)]
Handle C -> Java calls from Rust-spawned threads

Turns out you need to "attach" threads to the JVM before you can
make Java calls.

2 years agoRedo constructor function names to feel more natural in Java
Matt Corallo [Fri, 14 May 2021 15:57:13 +0000 (15:57 +0000)]
Redo constructor function names to feel more natural in Java

2 years agoSlightly reduce race conditions in NioPeerHandler
Matt Corallo [Mon, 3 May 2021 01:04:49 +0000 (01:04 +0000)]
Slightly reduce race conditions in NioPeerHandler

Sadly there's some restructuring that needs to happen to PeerHandler
before all possible race conditions go away.

2 years agoUpdate test ChannelManagerConstructor and invoice parsing as well
Matt Corallo [Sun, 2 May 2021 03:47:16 +0000 (03:47 +0000)]
Update test ChannelManagerConstructor and invoice parsing as well

2 years agoUse uint64_t instead of long for pointers represented in C
Matt Corallo [Sun, 2 May 2021 03:31:31 +0000 (03:31 +0000)]
Use uint64_t instead of long for pointers represented in C

While long is generally correct, the conversion of pointers to
long, then int64_t (passed to Java), then back to pointers
results in poor sign-extension, giving us invalid pointers.
Instead, convert to uint64_t everywhere and things work.

2 years agoExpose bindings versions and print on startup in debug mode
Matt Corallo [Sun, 2 May 2021 18:08:40 +0000 (11:08 -0700)]
Expose bindings versions and print on startup in debug mode

Also updates to latest upstream ldk-c-bindings include structure.

Co-Authored-By: Arik Sosman <git@arik.io>
2 years agoSupport debug builds on Android by calling native log and not using BT
Matt Corallo [Sun, 2 May 2021 03:33:21 +0000 (03:33 +0000)]
Support debug builds on Android by calling native log and not using BT

2 years agoHandle LDKStr in other structs and fix string conversion overread
Matt Corallo [Sat, 1 May 2021 00:01:33 +0000 (00:01 +0000)]
Handle LDKStr in other structs and fix string conversion overread

2 years agoHandle empty variant structs and enums in variants
Matt Corallo [Fri, 30 Apr 2021 21:50:03 +0000 (21:50 +0000)]
Handle empty variant structs and enums in variants

2 years agoUpdate HumanObjectPeerTest to print invoice in string form
Matt Corallo [Fri, 30 Apr 2021 04:36:49 +0000 (04:36 +0000)]
Update HumanObjectPeerTest to print invoice in string form

2 years agoUpdate tests for new upstream API and using invoicse
Matt Corallo [Fri, 30 Apr 2021 02:03:50 +0000 (02:03 +0000)]
Update tests for new upstream API and using invoicse

2 years agoUse explicit return type var names instead of guessing
Matt Corallo [Fri, 30 Apr 2021 02:03:14 +0000 (02:03 +0000)]
Use explicit return type var names instead of guessing

2 years agoMap more methods that go in UtilMethods
Matt Corallo [Thu, 29 Apr 2021 18:29:34 +0000 (18:29 +0000)]
Map more methods that go in UtilMethods

2 years agoDon't FREE things when we holds_ref if we're not calling *_free
Matt Corallo [Thu, 29 Apr 2021 18:28:36 +0000 (18:28 +0000)]
Don't FREE things when we holds_ref if we're not calling *_free

After this we still only have minor leaks across 128 runs of
HumanObjectPeerTest:
   314 allocations remained for 1126840 bytes.

2 years agoHandle u5, LDKTwentyBytes, and LDKRecoverableSignature
Matt Corallo [Thu, 29 Apr 2021 16:39:03 +0000 (16:39 +0000)]
Handle u5, LDKTwentyBytes, and LDKRecoverableSignature

2 years agoFix genbindings.sh sed call on OSX
Matt Corallo [Thu, 22 Apr 2021 17:27:25 +0000 (17:27 +0000)]
Fix genbindings.sh sed call on OSX

2 years agoHandle calls which take strings as an argument in Java
Matt Corallo [Thu, 22 Apr 2021 16:29:50 +0000 (16:29 +0000)]
Handle calls which take strings as an argument in Java

2 years agoMerge pull request #17 from TheBlueMatt/main
Matt Corallo [Thu, 22 Apr 2021 15:28:24 +0000 (15:28 +0000)]
Merge pull request #17 from TheBlueMatt/main

Update to latest upstream

3 years agoFix CI
Matt Corallo [Fri, 16 Apr 2021 02:39:52 +0000 (02:39 +0000)]
Fix CI

3 years agoUpdate tests for latest upstream API, sadly disabling the Sign wrapper test
Matt Corallo [Fri, 16 Apr 2021 00:38:28 +0000 (00:38 +0000)]
Update tests for latest upstream API, sadly disabling the Sign wrapper test

3 years agoTest new block connection API and update tests to new API
Matt Corallo [Sun, 21 Mar 2021 16:23:21 +0000 (12:23 -0400)]
Test new block connection API and update tests to new API

3 years agoUpdate auto-generated bindings
Matt Corallo [Wed, 31 Mar 2021 19:56:19 +0000 (15:56 -0400)]
Update auto-generated bindings

3 years agoHandle supertraits with constructor arguments
Matt Corallo [Thu, 15 Apr 2021 23:56:19 +0000 (23:56 +0000)]
Handle supertraits with constructor arguments

3 years agoHandle the somewhat half-mapped alias TransactionOutputs
Matt Corallo [Thu, 15 Apr 2021 23:00:35 +0000 (19:00 -0400)]
Handle the somewhat half-mapped alias TransactionOutputs

TransactionOutputs is actually a
C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ, but with a type alias that
gives it a more readable name in a few places. Sadly, we don't
support type aliases, so we have to just map it back before building
our bindings.

3 years agoTreat Txid as an alias for LDKThirtyTwoBytes
Matt Corallo [Tue, 23 Mar 2021 00:48:41 +0000 (20:48 -0400)]
Treat Txid as an alias for LDKThirtyTwoBytes

3 years agoMerge pull request #16 from TheBlueMatt/2021-03-background-manager-persister
Matt Corallo [Wed, 31 Mar 2021 20:11:43 +0000 (20:11 +0000)]
Merge pull request #16 from TheBlueMatt/2021-03-background-manager-persister

Adapt ChannelManagerConstructor to persist ChannelManager + handle events

3 years agoAdapt CI to new ldk-c-bindings genbindings.sh arguments 2021-03-background-manager-persister
Matt Corallo [Wed, 31 Mar 2021 19:52:07 +0000 (15:52 -0400)]
Adapt CI to new ldk-c-bindings genbindings.sh arguments

3 years agoUpdate auto-generated bindings
Matt Corallo [Wed, 31 Mar 2021 19:39:27 +0000 (15:39 -0400)]
Update auto-generated bindings

3 years agoSkip ChannelManagerConstructor in HumanObjectPeerTest
Matt Corallo [Wed, 31 Mar 2021 19:37:29 +0000 (15:37 -0400)]
Skip ChannelManagerConstructor in HumanObjectPeerTest

We should add a new, more generic, test later which uses it again.

3 years agoAdapt ChannelManagerConstructor to persist ChannelManager + handle events
Matt Corallo [Wed, 31 Mar 2021 19:28:23 +0000 (15:28 -0400)]
Adapt ChannelManagerConstructor to persist ChannelManager + handle events

3 years agoMerge pull request #15 from TheBlueMatt/2021-03-fix-clone
Matt Corallo [Tue, 30 Mar 2021 20:04:12 +0000 (20:04 +0000)]
Merge pull request #15 from TheBlueMatt/2021-03-fix-clone

Fix clone-required detection and handling for complex enums in vecs

3 years agoUpdate autogenerated bindings with correct FREE/clone semantics 2021-03-fix-clone
Matt Corallo [Tue, 30 Mar 2021 18:50:07 +0000 (14:50 -0400)]
Update autogenerated bindings with correct FREE/clone semantics

3 years agoFix maven import of jetbrains annotations
Matt Corallo [Tue, 30 Mar 2021 18:26:05 +0000 (14:26 -0400)]
Fix maven import of jetbrains annotations

3 years agoTest spending SpendableOutputs event contents
Matt Corallo [Tue, 30 Mar 2021 18:16:44 +0000 (14:16 -0400)]
Test spending SpendableOutputs event contents

3 years agoFix clone-required detection and handling for complex enums in vecs
Matt Corallo [Tue, 30 Mar 2021 18:15:09 +0000 (14:15 -0400)]
Fix clone-required detection and handling for complex enums in vecs

3 years agoMerge pull request #14 from TheBlueMatt/2021-03-fix-enums
Matt Corallo [Tue, 30 Mar 2021 20:02:37 +0000 (20:02 +0000)]
Merge pull request #14 from TheBlueMatt/2021-03-fix-enums

Handle tuple variants in complex enums

3 years agoUpdate tests to new enum API 2021-03-fix-enums
Matt Corallo [Tue, 30 Mar 2021 01:55:40 +0000 (21:55 -0400)]
Update tests to new enum API

3 years agoUpdate auto-generated bindings
Matt Corallo [Tue, 30 Mar 2021 01:58:56 +0000 (21:58 -0400)]
Update auto-generated bindings

3 years agoCleanup map lookup checks a bit
Matt Corallo [Tue, 30 Mar 2021 20:01:13 +0000 (16:01 -0400)]
Cleanup map lookup checks a bit

3 years agoHandle tuple variants in complex enums
Matt Corallo [Tue, 30 Mar 2021 01:53:28 +0000 (21:53 -0400)]
Handle tuple variants in complex enums

3 years agoMap result functions and rely on Rust constructors instead of news
Matt Corallo [Mon, 29 Mar 2021 21:13:48 +0000 (17:13 -0400)]
Map result functions and rely on Rust constructors instead of news

3 years agoMap enum functions into human structs and Result types sanely
Matt Corallo [Mon, 29 Mar 2021 21:11:44 +0000 (17:11 -0400)]
Map enum functions into human structs and Result types sanely

3 years agoMerge pull request #13 from TheBlueMatt/2021-03-check-determinism
Arik Sosman [Fri, 26 Mar 2021 22:30:29 +0000 (15:30 -0700)]
Merge pull request #13 from TheBlueMatt/2021-03-check-determinism

Split wasm output files + check build determinism in CI

3 years agoUpdate README to capture current status better 2021-03-check-determinism
Matt Corallo [Sun, 21 Mar 2021 17:28:04 +0000 (13:28 -0400)]
Update README to capture current status better

3 years agoSplit wasm output files + check build determinism in CI
Matt Corallo [Wed, 24 Mar 2021 15:24:34 +0000 (11:24 -0400)]
Split wasm output files + check build determinism in CI

3 years agoUpdate binaries with ldk-c-bindings path remapping enabled
Matt Corallo [Tue, 23 Mar 2021 14:00:43 +0000 (10:00 -0400)]
Update binaries with ldk-c-bindings path remapping enabled

3 years agoMap file paths in debug info to make debug libs path-independent
Matt Corallo [Wed, 24 Mar 2021 15:24:09 +0000 (11:24 -0400)]
Map file paths in debug info to make debug libs path-independent

3 years agoMerge pull request #12 from TheBlueMatt/2021-03-fresh-bindings
Matt Corallo [Mon, 22 Mar 2021 23:25:03 +0000 (23:25 +0000)]
Merge pull request #12 from TheBlueMatt/2021-03-fresh-bindings

Update bindings to latest upstream + Add CI

3 years agoMake java's bindings.c deterministic 2021-03-fresh-bindings
Matt Corallo [Mon, 22 Mar 2021 00:00:30 +0000 (20:00 -0400)]
Make java's bindings.c deterministic

3 years agoMore aggressively check for full GC run during HumanObjectPeerTest
Matt Corallo [Sun, 21 Mar 2021 19:39:24 +0000 (15:39 -0400)]
More aggressively check for full GC run during HumanObjectPeerTest

3 years agoDon't require a JNI_CFLAGS in genbindings.sh
Matt Corallo [Sun, 21 Mar 2021 17:10:01 +0000 (13:10 -0400)]
Don't require a JNI_CFLAGS in genbindings.sh

Apparently Android builds don't need this, so don't require them.

3 years agoUpdate auto-generated bindings
Matt Corallo [Sat, 20 Mar 2021 21:54:47 +0000 (17:54 -0400)]
Update auto-generated bindings

3 years agoFix HumanObjectPeerTest not delaying long enough in CI
Matt Corallo [Sun, 21 Mar 2021 23:33:03 +0000 (19:33 -0400)]
Fix HumanObjectPeerTest not delaying long enough in CI

3 years agoAdd CI runs to test bindings
Matt Corallo [Sat, 20 Mar 2021 21:51:33 +0000 (17:51 -0400)]
Add CI runs to test bindings

3 years agoUpdate tests to use Listen interface and for latest upstream
Matt Corallo [Sun, 21 Mar 2021 17:02:03 +0000 (13:02 -0400)]
Update tests to use Listen interface and for latest upstream

3 years agoWork around buggy Android nio implementation in batteries
Matt Corallo [Sat, 20 Mar 2021 20:50:28 +0000 (16:50 -0400)]
Work around buggy Android nio implementation in batteries

3 years agoDisambiguate jcall function names by including the trait name
Matt Corallo [Sat, 20 Mar 2021 20:32:52 +0000 (16:32 -0400)]
Disambiguate jcall function names by including the trait name

3 years agoMerge pull request #11 from TheBlueMatt/2021-03-license
Arik Sosman [Sun, 21 Mar 2021 06:05:18 +0000 (23:05 -0700)]
Merge pull request #11 from TheBlueMatt/2021-03-license

Add license information

3 years agoAdd license information 2021-03-license
Matt Corallo [Thu, 18 Mar 2021 15:57:04 +0000 (11:57 -0400)]
Add license information

3 years agoMerge pull request #10 from galderz/t_compilation_error
Matt Corallo [Thu, 18 Mar 2021 14:23:22 +0000 (14:23 +0000)]
Merge pull request #10 from galderz/t_compilation_error

Fix compilation errors

3 years agoIgnore IDE metadata and pycache
Galder Zamarreño [Thu, 18 Mar 2021 07:07:40 +0000 (08:07 +0100)]
Ignore IDE metadata and pycache

3 years agoUpdate API usages after bindings update
Galder Zamarreño [Thu, 18 Mar 2021 07:06:54 +0000 (08:06 +0100)]
Update API usages after bindings update

3 years agoMerge pull request #9 from TheBlueMatt/2021-03-cleanup-debug
Arik Sosman [Fri, 12 Mar 2021 19:42:43 +0000 (11:42 -0800)]
Merge pull request #9 from TheBlueMatt/2021-03-cleanup-debug

Move debug builds to a separate file

3 years agoMerge pull request #7 from TheBlueMatt/2021-03-tweaks
Arik Sosman [Fri, 12 Mar 2021 18:59:50 +0000 (10:59 -0800)]
Merge pull request #7 from TheBlueMatt/2021-03-tweaks

Slight tweaks

3 years agoUpdate bindings to latest upstream + ChannelMonitor_clone patch 2021-03-cleanup-debug
Matt Corallo [Fri, 12 Mar 2021 16:49:27 +0000 (11:49 -0500)]
Update bindings to latest upstream + ChannelMonitor_clone patch

3 years agoMove .so output to different names based on release/debug flag
Matt Corallo [Fri, 12 Mar 2021 16:47:00 +0000 (11:47 -0500)]
Move .so output to different names based on release/debug flag

3 years agoDrop at-exit memory leak assertion and note accuracy requirements
Matt Corallo [Fri, 12 Mar 2021 16:44:31 +0000 (11:44 -0500)]
Drop at-exit memory leak assertion and note accuracy requirements

3 years agoAdd a timeout to NioPeerHandler.connect 2021-03-tweaks
Matt Corallo [Wed, 10 Mar 2021 04:48:31 +0000 (23:48 -0500)]
Add a timeout to NioPeerHandler.connect

3 years agoAdd comment noting duplicate load_outputs_to_watch calls
Matt Corallo [Wed, 10 Mar 2021 04:22:58 +0000 (23:22 -0500)]
Add comment noting duplicate load_outputs_to_watch calls