Skip to content

Commit 6f572cf

Browse files
committed
Update LDK to current HEAD and BDK to 0.28.0
1 parent 8cdca11 commit 6f572cf

File tree

3 files changed

+32
-21
lines changed

3 files changed

+32
-21
lines changed

Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ description = "A ready-to-go node implementation built using LDK."
2525
#lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
2626
#lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["esplora-async"] }
2727

28-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518", features = ["max_level_trace", "std"] }
29-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518" }
30-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518" }
31-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518" }
32-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518" }
33-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518" }
34-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518", features = ["esplora-async"] }
28+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev="2ebbe6f30467cd7f0688673f7bfbac297e5c3506", features = ["max_level_trace", "std"] }
29+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev="2ebbe6f30467cd7f0688673f7bfbac297e5c3506" }
30+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev="2ebbe6f30467cd7f0688673f7bfbac297e5c3506" }
31+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev="2ebbe6f30467cd7f0688673f7bfbac297e5c3506" }
32+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev="2ebbe6f30467cd7f0688673f7bfbac297e5c3506" }
33+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev="2ebbe6f30467cd7f0688673f7bfbac297e5c3506" }
34+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev="2ebbe6f30467cd7f0688673f7bfbac297e5c3506", features = ["esplora-async"] }
3535

3636
#lightning = { path = "../rust-lightning/lightning", features = ["max_level_trace", "std"] }
3737
#lightning-invoice = { path = "../rust-lightning/lightning-invoice" }
@@ -41,7 +41,7 @@ lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-li
4141
#lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
4242
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async"] }
4343

44-
bdk = { version = "0.27.1", default-features = false, features = ["async-interface", "use-esplora-async", "sqlite-bundled"]}
44+
bdk = { version = "0.28.0", default-features = false, features = ["std", "async-interface", "use-esplora-async", "sqlite-bundled"]}
4545
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
4646
rusqlite = { version = "0.28.0", features = ["bundled"] }
4747
bitcoin = "0.29.2"

src/event.rs

+19-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ use crate::io::{
1010
use crate::logger::{log_error, log_info, Logger};
1111

1212
use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator};
13+
use lightning::events::Event as LdkEvent;
14+
use lightning::events::EventHandler as LdkEventHandler;
15+
use lightning::events::PaymentPurpose;
1316
use lightning::impl_writeable_tlv_based_enum;
1417
use lightning::ln::PaymentHash;
1518
use lightning::routing::gossip::NodeId;
1619
use lightning::util::errors::APIError;
17-
use lightning::util::events::Event as LdkEvent;
18-
use lightning::util::events::EventHandler as LdkEventHandler;
19-
use lightning::util::events::PaymentPurpose;
2020
use lightning::util::ser::{Readable, ReadableArgs, Writeable, Writer};
2121

2222
use bitcoin::secp256k1::Secp256k1;
@@ -329,6 +329,7 @@ where
329329
receiver_node_id: _,
330330
via_channel_id: _,
331331
via_user_channel_id: _,
332+
claim_deadline: _,
332333
} => {
333334
if let Some(info) = self.payment_store.get(&payment_hash) {
334335
if info.status == PaymentStatus::Succeeded {
@@ -548,6 +549,7 @@ where
548549
next_channel_id,
549550
fee_earned_msat,
550551
claim_from_onchain_tx,
552+
outbound_amount_forwarded_msat,
551553
} => {
552554
let read_only_network_graph = self.network_graph.read_only();
553555
let nodes = read_only_network_graph.nodes();
@@ -583,24 +585,36 @@ where
583585
format!(" to {}{}", node_str(&next_channel_id), channel_str(&next_channel_id));
584586

585587
let fee_earned = fee_earned_msat.unwrap_or(0);
588+
let outbound_amount_forwarded_msat = outbound_amount_forwarded_msat.unwrap_or(0);
586589
if claim_from_onchain_tx {
587590
log_info!(
588591
self.logger,
589-
"Forwarded payment{}{}, earning {}msat in fees from claiming onchain.",
592+
"Forwarded payment{}{} of {}msat, earning {}msat in fees from claiming onchain.",
590593
from_prev_str,
591594
to_next_str,
595+
outbound_amount_forwarded_msat,
592596
fee_earned,
593597
);
594598
} else {
595599
log_info!(
596600
self.logger,
597-
"Forwarded payment{}{}, earning {}msat in fees.",
601+
"Forwarded payment{}{} of {}msat, earning {}msat in fees.",
598602
from_prev_str,
599603
to_next_str,
604+
outbound_amount_forwarded_msat,
600605
fee_earned,
601606
);
602607
}
603608
}
609+
LdkEvent::ChannelPending {
610+
channel_id: _,
611+
user_channel_id: _,
612+
former_temporary_channel_id: _,
613+
counterparty_node_id: _,
614+
funding_txo: _,
615+
} => {
616+
// TODO!
617+
}
604618
LdkEvent::ChannelReady {
605619
channel_id, user_channel_id, counterparty_node_id, ..
606620
} => {

src/lib.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ use logger::{log_error, log_info, FilesystemLogger, Logger};
100100

101101
use lightning::chain::keysinterface::EntropySource;
102102
use lightning::chain::{chainmonitor, BestBlock, Confirm, Watch};
103-
use lightning::ln::channelmanager;
103+
use lightning::ln::channelmanager::{self, RecipientOnionFields};
104104
use lightning::ln::channelmanager::{
105105
ChainParameters, ChannelDetails, ChannelManagerReadArgs, PaymentId, Retry,
106106
};
@@ -1098,16 +1098,11 @@ impl Node {
10981098
let route_params = RouteParameters { payment_params, final_value_msat: amount_msat };
10991099

11001100
let retry_strategy = Retry::Timeout(LDK_PAYMENT_RETRY_TIMEOUT);
1101+
let recipient_fields = RecipientOnionFields { payment_secret };
11011102

11021103
match self
11031104
.channel_manager
1104-
.send_payment_with_retry(
1105-
payment_hash,
1106-
&payment_secret,
1107-
payment_id,
1108-
route_params,
1109-
retry_strategy,
1110-
)
1105+
.send_payment(payment_hash, recipient_fields, payment_id, route_params, retry_strategy)
11111106
.map_err(payment::PaymentError::Sending)
11121107
{
11131108
Ok(_payment_id) => {
@@ -1173,9 +1168,11 @@ impl Node {
11731168
),
11741169
final_value_msat: amount_msat,
11751170
};
1171+
let recipient_fields = RecipientOnionFields { payment_secret: None };
11761172

11771173
match self.channel_manager.send_spontaneous_payment_with_retry(
11781174
Some(payment_preimage),
1175+
recipient_fields,
11791176
PaymentId(payment_hash.0),
11801177
route_params,
11811178
Retry::Timeout(LDK_PAYMENT_RETRY_TIMEOUT),

0 commit comments

Comments
 (0)