Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge anchor support from tnull #11

Merged
merged 57 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
f88de49
Drop `stop_receiver` and switch to `stop_sender.subscribe()`
tnull Mar 1, 2024
b1bee0f
Reconnect to all persisted peers after restart
tnull Mar 1, 2024
71a3e32
Merge pull request #265 from tnull/2024-02-fix-peer-reconnection
tnull Mar 1, 2024
b291b3f
Fix CI by not building docs Windows on 1.63.0
tnull Mar 4, 2024
fcb85b5
Merge pull request #267 from tnull/2024-03-fix-windows-doc-build
tnull Mar 4, 2024
02f0000
Add `fee_paid_msat` to `PaymentSuccessful` event (#271)
jbesraa Mar 7, 2024
9f68aee
Move `common` test module to `common/mod.rs`
tnull Mar 7, 2024
d79b8ae
Return payment hash directly from `expect_payment_received` macro
tnull Mar 7, 2024
1cf74c6
Merge pull request #274 from tnull/2024-03-271-followup
tnull Mar 7, 2024
84ecc24
Introduce `status` method allowing to query the `Node`'s status
tnull Mar 6, 2024
0396fc5
Allow to retrieve the `Node`'s `Config`
tnull Mar 6, 2024
b052f15
Use `is_listening` flag in `connection_restart_behavior` test
tnull Mar 6, 2024
cdeeb7f
Merge pull request #272 from tnull/2024-03-add-node-status
tnull Mar 8, 2024
059ff2d
Pin `reqwest` to fix MSRV builds in CI
tnull Mar 11, 2024
3ae80be
Merge pull request #275 from tnull/2024-03-pin-reqwest-for-msrv
tnull Mar 11, 2024
9bfd4e5
WIP Upgrade to LDK v0.0.122
tnull Feb 7, 2024
d02350b
f Account for `DefaultRouter` taking an `EntropySource`
tnull Feb 7, 2024
75ab8e3
f Account for changed fields in `PaymentForwarded`
tnull Feb 7, 2024
90225f8
f Account for more fields in `ChannelPending`
tnull Feb 7, 2024
2e6a432
f Account for new `list_peers`/`peer_by_node_id` methods
tnull Feb 22, 2024
1ed3945
f Account for `to_channel_id` being removed
tnull Feb 19, 2024
b3f35d5
f Account for new `ClosureReason` variants
tnull Feb 23, 2024
96cea5e
f Use `PaymentHash::from` rather than manually hashing the preimage
tnull Mar 5, 2024
8aaf94a
f Account for `BestBlock` dropping accessor methods
tnull Mar 8, 2024
4a81898
DROPME: LDK: Bump to `InvoiceGenerated` event
tnull Mar 12, 2024
74a0db8
f Account for new `InvoiceGenerated` event
tnull Mar 12, 2024
4c6e0b9
Drop `KVStore` generic from `Node`
tnull Jan 30, 2024
d0a4e5a
Drop unnecessary `LDKNode` type alias completely
tnull Feb 7, 2024
42c3644
Expose `build_with_fs_store` in bindings
tnull Feb 7, 2024
fde1c68
Move connection logic to `connection.rs`
tnull Feb 21, 2024
a09e245
Require `Clone + Sync + Send + 'static` for event and connection loggers
tnull Feb 21, 2024
b3151cd
Use `tokio::select` on `connection_closed_future`
tnull Mar 4, 2024
e8f08ab
Add test for concurrent connection handling
tnull Mar 4, 2024
f2f1ab2
Add `ConnectionManager` handling pending connections
tnull Mar 4, 2024
f5e2ca5
Move BOLT11 payments API to `Bolt11PaymentHandler`
tnull Mar 5, 2024
6a943b1
Move spontaneous payments API to `SpontaneousPaymentHandler`
tnull Mar 5, 2024
4222815
Move onchain payments API to `OnchainPaymentHandler`
tnull Mar 5, 2024
096d439
Move `payment_store` to `payment` submodule
tnull Mar 5, 2024
478c9a9
Introduce `PaymentKind` to payment store, track by `PaymentId`
tnull Mar 8, 2024
9ab8e98
Add test ensuring de/ser compatibility with old format
tnull Mar 11, 2024
c798308
Add `payment_id` to `Payment{Successful,Failed,Received}` events
tnull Mar 11, 2024
08b0b0c
Introduce `channel_type` field to `ChannelDetails`
tnull Jan 17, 2024
7d75d11
Introduce `AnchorChannelsConfig`
tnull Feb 6, 2024
de55a2a
Implement Anchor channel event handling
tnull Jun 27, 2023
57f239d
Maintain and expose anchor reserve
tnull Feb 19, 2024
71d6a7e
Use Anchor channels in CLN integration test
tnull Feb 20, 2024
995109b
Add `force` flag to allow channel force-closure
tnull Feb 26, 2024
23a9cbc
Merge remote-tracking branch 'tnull/2023-07-add-anchor-support' into …
Mar 14, 2024
d7755d0
Reformat files.
Mar 14, 2024
19207d6
Remove unused imports.
Mar 14, 2024
695fe63
chore: remove bolt11 invoice from bolt11jit (currently unused)
rolznz Mar 16, 2024
d25dcb1
feat: re-add last_update
rolznz Mar 16, 2024
3ba2432
fix: update bindings file
rolznz Mar 16, 2024
16f35c0
fix: payment store
rolznz Mar 16, 2024
d0605a8
chore: fix formatting
rolznz Mar 16, 2024
779729b
fix: old payment test
rolznz Mar 16, 2024
5676c2c
fix: make last_update optional
rolznz Mar 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
cargo update -p hashlink --precise "0.8.2" --verbose # hashlink 0.8.3 requires hashbrown 0.14, requiring 1.64.0
cargo update -p proptest --precise "1.2.0" --verbose # proptest 1.3.0 requires rustc 1.64.0
cargo update -p regex --precise "1.9.6" --verbose # regex 1.10.0 requires rustc 1.65.0
cargo update -p home --precise "0.5.5" --verbose # home v0.5.9, requires rustc 1.70 or newer
cargo update -p home --precise "0.5.5" --verbose # home v0.5.9 requires rustc 1.70 or newer
cargo update -p reqwest --precise "0.11.24" --verbose # reqwest v0.11.25 requires rustc 1.64 or newer
- name: Set RUSTFLAGS to deny warnings
if: "matrix.toolchain == 'stable'"
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
Expand Down
29 changes: 19 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ panic = 'abort' # Abort on panic
default = []

[dependencies]
lightning = { version = "0.0.121", features = ["std"] }
lightning-invoice = { version = "0.29.0" }
lightning-net-tokio = { version = "0.0.121" }
lightning-persister = { version = "0.0.121" }
lightning-background-processor = { version = "0.0.121", features = ["futures"] }
lightning-rapid-gossip-sync = { version = "0.0.121" }
lightning-transaction-sync = { version = "0.0.121", features = ["esplora-async-https", "time"] }
lightning-liquidity = { version = "0.1.0-alpha.1", features = ["std"] }
#lightning = { version = "0.0.121", features = ["std"] }
#lightning-invoice = { version = "0.29.0" }
#lightning-net-tokio = { version = "0.0.121" }
#lightning-persister = { version = "0.0.121" }
#lightning-background-processor = { version = "0.0.121", features = ["futures"] }
#lightning-rapid-gossip-sync = { version = "0.0.121" }
#lightning-transaction-sync = { version = "0.0.121", features = ["esplora-async-https", "time"] }
#lightning-liquidity = { version = "0.1.0-alpha.1", features = ["std"] }

lightning = { git = "https://github.com/tnull/rust-lightning", branch = "2024-03-invoice-generated-event", features = ["std"] }
lightning-invoice = { git = "https://github.com/tnull/rust-lightning", branch = "2024-03-invoice-generated-event" }
lightning-net-tokio = { git = "https://github.com/tnull/rust-lightning", branch = "2024-03-invoice-generated-event" }
lightning-persister = { git = "https://github.com/tnull/rust-lightning", branch = "2024-03-invoice-generated-event" }
lightning-background-processor = { git = "https://github.com/tnull/rust-lightning", branch = "2024-03-invoice-generated-event", features = ["futures"] }
lightning-rapid-gossip-sync = { git = "https://github.com/tnull/rust-lightning", branch = "2024-03-invoice-generated-event" }
lightning-transaction-sync = { git = "https://github.com/tnull/rust-lightning", branch = "2024-03-invoice-generated-event", features = ["esplora-async"] }
lightning-liquidity = { git = "https://github.com/tnull/lightning-liquidity", branch = "2024-03-invoice-generated-event", features = ["std"] }

#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std"] }
#lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
Expand Down Expand Up @@ -64,7 +73,6 @@ bip39 = "2.0.0"

rand = "0.8.5"
chrono = { version = "0.4", default-features = false, features = ["clock"] }
futures = "0.3"
tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "sync" ] }
esplora-client = { version = "0.6", default-features = false }
libc = "0.2"
Expand All @@ -78,8 +86,9 @@ prost = { version = "0.11.6", default-features = false}
winapi = { version = "0.3", features = ["winbase"] }

[dev-dependencies]
lightning = { version = "0.0.121", features = ["std", "_test_utils"] }
#lightning = { version = "0.0.121", features = ["std", "_test_utils"] }
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std", "_test_utils"] }
lightning = { git = "https://github.com/tnull/rust-lightning", branch = "2024-03-invoice-generated-event", features = ["std", "_test_utils"] }
electrum-client = { version = "0.15.1", default-features = true }
bitcoincore-rpc = { version = "0.17.0", default-features = false }
proptest = "1.0.0"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A ready-to-go Lightning node library built using [LDK][ldk] and [BDK][bdk].
LDK Node is a self-custodial Lightning node in library form. Its central goal is to provide a small, simple, and straightforward interface that enables users to easily set up and run a Lightning node with an integrated on-chain wallet. While minimalism is at its core, LDK Node aims to be sufficiently modular and configurable to be useful for a variety of use cases.

## Getting Started
The primary abstraction of the library is the [`Node`][api_docs_node], which can be retrieved by setting up and configuring a [`Builder`][api_docs_builder] to your liking and calling one of the `build` methods. `Node` can then be controlled via commands such as `start`, `stop`, `connect_open_channel`, `send_payment`, etc.
The primary abstraction of the library is the [`Node`][api_docs_node], which can be retrieved by setting up and configuring a [`Builder`][api_docs_builder] to your liking and calling one of the `build` methods. `Node` can then be controlled via commands such as `start`, `stop`, `connect_open_channel`, `send`, etc.

```rust
use ldk_node::Builder;
Expand All @@ -31,7 +31,7 @@ fn main() {

node.start().unwrap();

let funding_address = node.new_onchain_address();
let funding_address = node.onchain_payment().new_address();

// .. fund address ..

Expand All @@ -44,7 +44,7 @@ fn main() {
node.event_handled();

let invoice = Bolt11Invoice::from_str("INVOICE_STR").unwrap();
node.send_payment(&invoice).unwrap();
node.bolt11_payment().send(&invoice).unwrap();

node.stop().unwrap();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class AndroidLibTest {
val nodeId2 = node2.nodeId()
println("Node Id 2: $nodeId2")

val address1 = node1.newOnchainAddress()
val address1 = node1.onchain_payment().newOnchainAddress()
println("Funding address 1: $address1")

val address2 = node2.newOnchainAddress()
val address2 = node2.onchain_payment().newOnchainAddress()
println("Funding address 2: $address2")

node1.stop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ class LibraryTest {
val nodeId2 = node2.nodeId()
println("Node Id 2: $nodeId2")

val address1 = node1.newOnchainAddress()
val address1 = node1.onchainPayment().newAddress()
println("Funding address 1: $address1")

val address2 = node2.newOnchainAddress()
val address2 = node2.onchainPayment().newAddress()
println("Funding address 2: $address2")

val txid1 = sendToAddress(address1, 100000u)
Expand Down Expand Up @@ -203,9 +203,9 @@ class LibraryTest {
val spendableBalance2AfterOpen = node2.listBalances().spendableOnchainBalanceSats
println("Spendable balance 1 after open: $spendableBalance1AfterOpen")
println("Spendable balance 2 after open: $spendableBalance2AfterOpen")
assert(spendableBalance1AfterOpen > 49000u)
assert(spendableBalance1AfterOpen < 50000u)
assertEquals(100000uL, spendableBalance2AfterOpen)
assert(spendableBalance1AfterOpen > 24000u)
assert(spendableBalance1AfterOpen < 25000u)
assertEquals(75000uL, spendableBalance2AfterOpen)

val channelReadyEvent1 = node1.waitNextEvent()
println("Got event: $channelReadyEvent1")
Expand All @@ -222,9 +222,9 @@ class LibraryTest {
else -> return
}

val invoice = node2.receivePayment(2500000u, "asdf", 9217u)
val invoice = node2.bolt11Payment().receive(2500000u, "asdf", 9217u)

node1.sendPayment(invoice)
node1.bolt11Payment().send(invoice)

val paymentSuccessfulEvent = node1.waitNextEvent()
println("Got event: $paymentSuccessfulEvent")
Expand All @@ -239,7 +239,7 @@ class LibraryTest {
assert(node1.listPayments().size == 1)
assert(node2.listPayments().size == 1)

node2.closeChannel(userChannelId, nodeId1)
node2.closeChannel(userChannelId, nodeId1, false)

val channelClosedEvent1 = node1.waitNextEvent()
println("Got event: $channelClosedEvent1")
Expand Down
Loading
Loading