Skip to content

Commit 6acac38

Browse files
committed
start writing bindings
WIP: expose ChannelManager from bindings crate to ffi update bindings udpate bindings to not expose result type as FFI update prepare FFIResult finish tests for FFIResult prepare thread_handle prepare is_null prepare all FFI handler type avoid all compiler error by using ARc separate adaptor types into adaptors folder add BufferToSmall error case to FFIResult kind Add new entrypoints for fetching and testing last result for FFI add entrypoint for testing remove input argument from test ffi update update update update update amend update udpate broadcaster_wrapper ffi interface update cleanup: rename variables and remove unused deps remove unused cbindgen.toml delete outdated readme message do not specify repr(C) to Record type Add `UnwandSafe` and `RefUnwindSafe` trait bound * `Logger` and `ChainWatchInterface` were trait which has to cross ffi boundary. for a foreign language to catch a panic caused in `rust-lightning` these two traits must be `UnwindSafe` so explicitly add. Fix miscs * Use usize everywhere for len * Use `OutPoint` from lightning instead of bitcoin udpate comment start writing ffi interface for testing logger fix bug that FFITransaction points to garbage location Remove unused `&Self` parameter from FFI delegate. update add entrypoint for releasing channel manager remove unused test function fix bug in FFIChainWatchInterface Constructor Revert "remove unused test function" This reverts commit 4a1cccb. add new entrypoint send_payment fix bug in broadcaster stop receiving SafeHandle twice take everything as delegate in constructor * Since otherwise it sometimes crashes by GC in C# side. cleanup stop using debug_assertions as a feature remove some unused imports and implement Error trait for APIError Simplify FFIRoute * When passing struct through FFI boundary, if the object has nested array it will cause headache for preventing it from GCed. So we just pass binary serialized object and (de)serialize after passing. In this case, `FFIRoute`. * Prepare Debug trait for Route object. add entrpoint for getting pending events from chanman update: FFI PeerManager create/dispose methods add deep_copy method to array_struct update remove unnecessary dirty tests update: add process_event function for FFI remove repr(C) from lightning pcakge fix build error in lightning update ffi for BasicMPP fix some compiler warning return Bool from read_event Simplify ChainWatchInterface * delegate some `FFIChainWatchInteface`'s work to `ChainWatchInterfaceUtil` * remove now-useless ChannelMonitor and its related functions, objects refactor create_channel_manager to be more generic fix bug in deep_copy return internal_error directly when converting FFI pub/secret key stop using wacky deep_copy method return act_one when calling new_outbound from C# stop using FFIBytes for return value of new_outbound simplify array_struct by not using generics expose PeerManager::get_peer_node_ids to ffi fix build error after rebasing to master give channel maanger from outside world when initializing PeerManager add many ffi entrypoints for ChannelManager
1 parent fd71f8b commit 6acac38

33 files changed

+2921
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
members = [
44
"lightning",
55
"lightning-net-tokio",
6+
"bindings",
67
]
78

89
# Our tests do actual crypo and lots of work, the tradeoff for -O1 is well worth it

bindings/Cargo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[package]
2+
name = "bindings"
3+
version = "0.1.0"
4+
authors = ["joe.miyamoto <[email protected]>"]
5+
edition = "2018"
6+
7+
[lib]
8+
crate-type=["staticlib", "cdylib"]
9+
10+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
11+
12+
[dependencies]
13+
lightning = { path = "../lightning" }
14+
bitcoin = "0.23"
15+
bitcoin_hashes = "0.7"
16+
17+
# We want to include this only for debug build, but following line does not work.
18+
# [target.'cfg(debug_assertions)'.dependencies]
19+
# see https://github.com/rust-lang/cargo/issues/7634
20+
# as a workaround, we just included it as an usual dependency
21+
hex = "0.3"
22+
rand = "0.7.3"
23+

bindings/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# FFI binding interface for rust-lighting
2+
3+
Currently, it only supports C#, other languages are untested.
4+

0 commit comments

Comments
 (0)