Skip to content

Commit

Permalink
Merge remote-tracking branch 'tnull/2023-07-add-anchor-support' into …
Browse files Browse the repository at this point in the history
…merge-anchor-support-from-upstream

# Conflicts:
#	.github/workflows/rust.yml
#	bindings/ldk_node.udl
#	src/event.rs
#	src/lib.rs
#	src/payment_store.rs
#	tests/common/mod.rs
  • Loading branch information
Roman Dmitrienko committed Mar 14, 2024
2 parents 29894bb + 995109b commit 23a9cbc
Show file tree
Hide file tree
Showing 33 changed files with 3,000 additions and 1,525 deletions.
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

0 comments on commit 23a9cbc

Please sign in to comment.