Skip to content

Commit 7cef820

Browse files
authored
Merge pull request #655 from lightningdevkit/develop
Merge `develop` into `main`
2 parents 8bd7f4d + ca1e5a7 commit 7cef820

Some content is hidden

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

55 files changed

+2353
-1693
lines changed

.github/workflows/kotlin.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ jobs:
3939
- name: Generate Kotlin JVM
4040
run: ./scripts/uniffi_bindgen_generate_kotlin.sh
4141

42-
- name: Install `bindgen-cli`
43-
run: cargo install --force bindgen-cli
44-
4542
- name: Generate Kotlin Android
4643
run: ./scripts/uniffi_bindgen_generate_kotlin_android.sh
4744

Cargo.toml

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,57 @@ panic = 'abort' # Abort on panic
2828
default = []
2929

3030
[dependencies]
31-
lightning = { version = "0.1.0", features = ["std"] }
32-
lightning-types = { version = "0.2.0" }
33-
lightning-invoice = { version = "0.33.0", features = ["std"] }
34-
lightning-net-tokio = { version = "0.1.0" }
35-
lightning-persister = { version = "0.1.0" }
36-
lightning-background-processor = { version = "0.1.0", features = ["futures"] }
37-
lightning-rapid-gossip-sync = { version = "0.1.0" }
38-
lightning-block-sync = { version = "0.1.0", features = ["rpc-client", "rest-client", "tokio"] }
39-
lightning-transaction-sync = { version = "0.1.0", features = ["esplora-async-https", "time", "electrum"] }
40-
lightning-liquidity = { version = "0.1.0", features = ["std"] }
31+
#lightning = { version = "0.1.0", features = ["std"] }
32+
#lightning-types = { version = "0.2.0" }
33+
#lightning-invoice = { version = "0.33.0", features = ["std"] }
34+
#lightning-net-tokio = { version = "0.1.0" }
35+
#lightning-persister = { version = "0.1.0" }
36+
#lightning-background-processor = { version = "0.1.0" }
37+
#lightning-rapid-gossip-sync = { version = "0.1.0" }
38+
#lightning-block-sync = { version = "0.1.0", features = ["rest-client", "rpc-client", "tokio"] }
39+
#lightning-transaction-sync = { version = "0.1.0", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
40+
#lightning-liquidity = { version = "0.1.0", features = ["std"] }
41+
#lightning-macros = { version = "0.1.0" }
4142

4243
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["std"] }
4344
#lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
4445
#lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["std"] }
4546
#lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
4647
#lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
47-
#lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["futures"] }
48+
#lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
4849
#lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
49-
#lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["rpc-client", "tokio"] }
50-
#lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["esplora-async-https", "electrum", "time"] }
50+
#lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["rest-client", "rpc-client", "tokio"] }
51+
#lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
5152
#lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
53+
#lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
54+
55+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994", features = ["std"] }
56+
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994" }
57+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994", features = ["std"] }
58+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994" }
59+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994" }
60+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994" }
61+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994" }
62+
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994", features = ["rest-client", "rpc-client", "tokio"] }
63+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
64+
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994" }
65+
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994" }
5266

5367
#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
5468
#lightning-types = { path = "../rust-lightning/lightning-types" }
5569
#lightning-invoice = { path = "../rust-lightning/lightning-invoice", features = ["std"] }
5670
#lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" }
5771
#lightning-persister = { path = "../rust-lightning/lightning-persister" }
58-
#lightning-background-processor = { path = "../rust-lightning/lightning-background-processor", features = ["futures"] }
72+
#lightning-background-processor = { path = "../rust-lightning/lightning-background-processor" }
5973
#lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
60-
#lightning-block-sync = { path = "../rust-lightning/lightning-block-sync", features = ["rpc-client", "tokio"] }
61-
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async-https", "electrum", "time"] }
74+
#lightning-block-sync = { path = "../rust-lightning/lightning-block-sync", features = ["rest-client", "rpc-client", "tokio"] }
75+
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
6276
#lightning-liquidity = { path = "../rust-lightning/lightning-liquidity", features = ["std"] }
77+
#lightning-macros = { path = "../rust-lightning/lightning-macros" }
6378

6479
bdk_chain = { version = "0.23.0", default-features = false, features = ["std"] }
6580
bdk_esplora = { version = "0.22.0", default-features = false, features = ["async-https-rustls", "tokio"]}
66-
bdk_electrum = { version = "0.23.0", default-features = false, features = ["use-rustls"]}
81+
bdk_electrum = { version = "0.23.0", default-features = false, features = ["use-rustls-ring"]}
6782
bdk_wallet = { version = "2.0.0", default-features = false, features = ["std", "keys-bip39"]}
6883

6984
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
@@ -78,12 +93,7 @@ rand = "0.8.5"
7893
chrono = { version = "0.4", default-features = false, features = ["clock"] }
7994
tokio = { version = "1.37", default-features = false, features = [ "rt-multi-thread", "time", "sync", "macros" ] }
8095
esplora-client = { version = "0.12", default-features = false, features = ["tokio", "async-https-rustls"] }
81-
82-
# FIXME: This was introduced to decouple the `bdk_esplora` and
83-
# `lightning-transaction-sync` APIs. We should drop it as part of the upgrade
84-
# to LDK 0.2.
85-
esplora-client_0_11 = { package = "esplora-client", version = "0.11", default-features = false, features = ["tokio", "async-https-rustls"] }
86-
electrum-client = { version = "0.24.0", default-features = true }
96+
electrum-client = { version = "0.24.0", default-features = false, features = ["proxy", "use-rustls-ring"] }
8797
libc = "0.2"
8898
uniffi = { version = "0.28.3", features = ["build"], optional = true }
8999
serde = { version = "1.0.210", default-features = false, features = ["std", "derive"] }
@@ -97,8 +107,9 @@ prost = { version = "0.11.6", default-features = false}
97107
winapi = { version = "0.3", features = ["winbase"] }
98108

99109
[dev-dependencies]
100-
lightning = { version = "0.1.0", features = ["std", "_test_utils"] }
110+
#lightning = { version = "0.1.0", features = ["std", "_test_utils"] }
101111
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std", "_test_utils"] }
112+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "3e21ba37a133977d4247e86f25df983b39326994", features = ["std", "_test_utils"] }
102113
#lightning = { path = "../rust-lightning/lightning", features = ["std", "_test_utils"] }
103114
proptest = "1.0.0"
104115
regex = "1.5.6"

bindings/ldk_node.udl

Lines changed: 54 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dictionary Config {
1212
sequence<PublicKey> trusted_peers_0conf;
1313
u64 probing_liquidity_limit_multiplier;
1414
AnchorChannelsConfig? anchor_channels_config;
15-
SendingParameters? sending_parameters;
15+
RouteParametersConfig? route_parameters;
1616
};
1717

1818
dictionary AnchorChannelsConfig {
@@ -95,6 +95,8 @@ interface Builder {
9595
[Throws=BuildError]
9696
void set_node_alias(string node_alias);
9797
[Throws=BuildError]
98+
void set_async_payments_role(AsyncPaymentsRole? role);
99+
[Throws=BuildError]
98100
Node build();
99101
[Throws=BuildError]
100102
Node build_with_fs_store();
@@ -167,13 +169,13 @@ interface Bolt11InvoiceDescription {
167169

168170
interface Bolt11Payment {
169171
[Throws=NodeError]
170-
PaymentId send([ByRef]Bolt11Invoice invoice, SendingParameters? sending_parameters);
172+
PaymentId send([ByRef]Bolt11Invoice invoice, RouteParametersConfig? route_parameters);
171173
[Throws=NodeError]
172-
PaymentId send_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat, SendingParameters? sending_parameters);
174+
PaymentId send_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat, RouteParametersConfig? route_parameters);
173175
[Throws=NodeError]
174-
void send_probes([ByRef]Bolt11Invoice invoice);
176+
void send_probes([ByRef]Bolt11Invoice invoice, RouteParametersConfig? route_parameters);
175177
[Throws=NodeError]
176-
void send_probes_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat);
178+
void send_probes_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat, RouteParametersConfig? route_parameters);
177179
[Throws=NodeError]
178180
void claim_for_hash(PaymentHash payment_hash, u64 claimable_amount_msat, PaymentPreimage preimage);
179181
[Throws=NodeError]
@@ -209,17 +211,23 @@ interface Bolt12Payment {
209211
Bolt12Invoice request_refund_payment([ByRef]Refund refund);
210212
[Throws=NodeError]
211213
Refund initiate_refund(u64 amount_msat, u32 expiry_secs, u64? quantity, string? payer_note);
214+
[Throws=NodeError]
215+
Offer receive_async();
216+
[Throws=NodeError]
217+
void set_paths_to_static_invoice_server(bytes paths);
218+
[Throws=NodeError]
219+
bytes blinded_paths_for_async_recipient(bytes recipient_id);
212220
};
213221

214222
interface SpontaneousPayment {
215223
[Throws=NodeError]
216-
PaymentId send(u64 amount_msat, PublicKey node_id, SendingParameters? sending_parameters);
224+
PaymentId send(u64 amount_msat, PublicKey node_id, RouteParametersConfig? route_parameters);
217225
[Throws=NodeError]
218-
PaymentId send_with_custom_tlvs(u64 amount_msat, PublicKey node_id, SendingParameters? sending_parameters, sequence<CustomTlvRecord> custom_tlvs);
226+
PaymentId send_with_custom_tlvs(u64 amount_msat, PublicKey node_id, RouteParametersConfig? route_parameters, sequence<CustomTlvRecord> custom_tlvs);
219227
[Throws=NodeError]
220-
PaymentId send_with_preimage(u64 amount_msat, PublicKey node_id, PaymentPreimage preimage, SendingParameters? sending_parameters);
228+
PaymentId send_with_preimage(u64 amount_msat, PublicKey node_id, PaymentPreimage preimage, RouteParametersConfig? route_parameters);
221229
[Throws=NodeError]
222-
PaymentId send_with_preimage_and_custom_tlvs(u64 amount_msat, PublicKey node_id, sequence<CustomTlvRecord> custom_tlvs, PaymentPreimage preimage, SendingParameters? sending_parameters);
230+
PaymentId send_with_preimage_and_custom_tlvs(u64 amount_msat, PublicKey node_id, sequence<CustomTlvRecord> custom_tlvs, PaymentPreimage preimage, RouteParametersConfig? route_parameters);
223231
[Throws=NodeError]
224232
void send_probes(u64 amount_msat, PublicKey node_id);
225233
};
@@ -254,7 +262,7 @@ interface LSPS1Liquidity {
254262
[Throws=NodeError]
255263
LSPS1OrderStatus request_channel(u64 lsp_balance_sat, u64 client_balance_sat, u32 channel_expiry_blocks, boolean announce_channel);
256264
[Throws=NodeError]
257-
LSPS1OrderStatus check_order_status(OrderId order_id);
265+
LSPS1OrderStatus check_order_status(LSPS1OrderId order_id);
258266
};
259267

260268
[Error]
@@ -311,11 +319,12 @@ enum NodeError {
311319
"InsufficientFunds",
312320
"LiquiditySourceUnavailable",
313321
"LiquidityFeeTooHigh",
322+
"InvalidBlindedPaths",
323+
"AsyncPaymentServicesDisabled",
314324
};
315325

316326
dictionary NodeStatus {
317327
boolean is_running;
318-
boolean is_listening;
319328
BestBlock current_best_block;
320329
u64? latest_lightning_wallet_sync_timestamp;
321330
u64? latest_onchain_wallet_sync_timestamp;
@@ -347,6 +356,7 @@ enum BuildError {
347356
"WalletSetupFailed",
348357
"LoggerSetupFailed",
349358
"NetworkMismatch",
359+
"AsyncPaymentsConfigMismatch",
350360
};
351361

352362
[Trait]
@@ -392,7 +402,7 @@ enum PaymentFailureReason {
392402
[Enum]
393403
interface ClosureReason {
394404
CounterpartyForceClosed(UntrustedString peer_msg);
395-
HolderForceClosed(boolean? broadcasted_latest_txn);
405+
HolderForceClosed(boolean? broadcasted_latest_txn, string message);
396406
LegacyCooperativeClosure();
397407
CounterpartyInitiatedCooperativeClosure();
398408
LocallyInitiatedCooperativeClosure();
@@ -402,8 +412,9 @@ interface ClosureReason {
402412
DisconnectedPeer();
403413
OutdatedChannelManager();
404414
CounterpartyCoopClosedUnfundedChannel();
415+
LocallyCoopClosedUnfundedChannel();
405416
FundingBatchClosure();
406-
HTLCsTimedOut();
417+
HTLCsTimedOut( PaymentHash? payment_hash );
407418
PeerFeerateTooLow(u32 peer_feerate_sat_per_kw, u32 required_feerate_sat_per_kw);
408419
};
409420

@@ -456,11 +467,11 @@ dictionary PaymentDetails {
456467
u64 latest_update_timestamp;
457468
};
458469

459-
dictionary SendingParameters {
460-
MaxTotalRoutingFeeLimit? max_total_routing_fee_msat;
461-
u32? max_total_cltv_expiry_delta;
462-
u8? max_path_count;
463-
u8? max_channel_saturation_power_of_half;
470+
dictionary RouteParametersConfig {
471+
u64? max_total_routing_fee_msat;
472+
u32 max_total_cltv_expiry_delta;
473+
u8 max_path_count;
474+
u8 max_channel_saturation_power_of_half;
464475
};
465476

466477
dictionary CustomTlvRecord {
@@ -469,13 +480,13 @@ dictionary CustomTlvRecord {
469480
};
470481

471482
dictionary LSPS1OrderStatus {
472-
OrderId order_id;
473-
OrderParameters order_params;
474-
PaymentInfo payment_options;
475-
ChannelOrderInfo? channel_state;
483+
LSPS1OrderId order_id;
484+
LSPS1OrderParams order_params;
485+
LSPS1PaymentInfo payment_options;
486+
LSPS1ChannelInfo? channel_state;
476487
};
477488

478-
dictionary OrderParameters {
489+
dictionary LSPS1OrderParams {
479490
u64 lsp_balance_sat;
480491
u64 client_balance_sat;
481492
u16 required_channel_confirmations;
@@ -485,22 +496,22 @@ dictionary OrderParameters {
485496
boolean announce_channel;
486497
};
487498

488-
dictionary PaymentInfo {
489-
Bolt11PaymentInfo? bolt11;
490-
OnchainPaymentInfo? onchain;
499+
dictionary LSPS1PaymentInfo {
500+
LSPS1Bolt11PaymentInfo? bolt11;
501+
LSPS1OnchainPaymentInfo? onchain;
491502
};
492503

493-
dictionary Bolt11PaymentInfo {
494-
PaymentState state;
495-
DateTime expires_at;
504+
dictionary LSPS1Bolt11PaymentInfo {
505+
LSPS1PaymentState state;
506+
LSPSDateTime expires_at;
496507
u64 fee_total_sat;
497508
u64 order_total_sat;
498509
Bolt11Invoice invoice;
499510
};
500511

501-
dictionary OnchainPaymentInfo {
502-
PaymentState state;
503-
DateTime expires_at;
512+
dictionary LSPS1OnchainPaymentInfo {
513+
LSPS1PaymentState state;
514+
LSPSDateTime expires_at;
504515
u64 fee_total_sat;
505516
u64 order_total_sat;
506517
Address address;
@@ -509,24 +520,18 @@ dictionary OnchainPaymentInfo {
509520
Address? refund_onchain_address;
510521
};
511522

512-
dictionary ChannelOrderInfo {
513-
DateTime funded_at;
523+
dictionary LSPS1ChannelInfo {
524+
LSPSDateTime funded_at;
514525
OutPoint funding_outpoint;
515-
DateTime expires_at;
526+
LSPSDateTime expires_at;
516527
};
517528

518-
enum PaymentState {
529+
enum LSPS1PaymentState {
519530
"ExpectPayment",
520531
"Paid",
521532
"Refunded",
522533
};
523534

524-
[Enum]
525-
interface MaxTotalRoutingFeeLimit {
526-
None ();
527-
Some ( u64 amount_msat );
528-
};
529-
530535
[NonExhaustive]
531536
enum Network {
532537
"Bitcoin",
@@ -716,6 +721,11 @@ enum Currency {
716721
"Signet",
717722
};
718723

724+
enum AsyncPaymentsRole {
725+
"Client",
726+
"Server",
727+
};
728+
719729
dictionary RouteHintHop {
720730
PublicKey src_node_id;
721731
u64 short_channel_id;
@@ -861,7 +871,7 @@ typedef string UntrustedString;
861871
typedef string NodeAlias;
862872

863873
[Custom]
864-
typedef string OrderId;
874+
typedef string LSPS1OrderId;
865875

866876
[Custom]
867-
typedef string DateTime;
877+
typedef string LSPSDateTime;

rustfmt.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ match_block_trailing_comma = true
1010
# UNSTABLE: format_macro_matchers = true
1111
# UNSTABLE: format_strings = true
1212
# UNSTABLE: group_imports = "StdExternalCrate"
13+
# UNSTABLE: reorder_imports = true
14+
# UNSTABLE: imports_granularity = "Module"

0 commit comments

Comments
 (0)