Skip to content

Commit d80d422

Browse files
committed
Invoke process_pending_htlcs on HTLC expiry timer
Calls the new LSPS4 process_pending_htlcs() method on the existing 5-second HTLC expiry timer. This retries forwarding HTLCs that were deferred at peer_connected time because the channel was not yet usable (channel_reestablish still in progress).
1 parent f881ab0 commit d80d422

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ default = []
4242
# lightning-macros = { version = "0.2.0" }
4343

4444
# Branch: https://github.com/moneydevkit/rust-lightning/commits/lsp-0.2.0/
45-
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85", features = ["std"] }
46-
lightning-types = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85" }
47-
lightning-invoice = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85", features = ["std"] }
48-
lightning-net-tokio = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85" }
49-
lightning-persister = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85", features = ["tokio"] }
50-
lightning-background-processor = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85" }
51-
lightning-rapid-gossip-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85" }
52-
lightning-block-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85", features = ["rest-client", "rpc-client", "tokio"] }
53-
lightning-transaction-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
54-
lightning-liquidity = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85", features = ["std"] }
55-
lightning-macros = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85" }
45+
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79", features = ["std"] }
46+
lightning-types = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79" }
47+
lightning-invoice = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79", features = ["std"] }
48+
lightning-net-tokio = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79" }
49+
lightning-persister = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79", features = ["tokio"] }
50+
lightning-background-processor = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79" }
51+
lightning-rapid-gossip-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79" }
52+
lightning-block-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79", features = ["rest-client", "rpc-client", "tokio"] }
53+
lightning-transaction-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
54+
lightning-liquidity = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79", features = ["std"] }
55+
lightning-macros = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79" }
5656

5757
#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
5858
#lightning-types = { path = "../rust-lightning/lightning-types" }
@@ -101,7 +101,7 @@ winapi = { version = "0.3", features = ["winbase"] }
101101
[dev-dependencies]
102102
# lightning = { version = "0.2.0", features = ["std", "_test_utils"] }
103103
# Branch: https://github.com/moneydevkit/rust-lightning/commits/lsp-0.2.0/
104-
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "1432d063c277f303266a6a5345789617f2e05e85", features = ["std", "_test_utils"] }
104+
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "c14b445c941614f0e76d52afd0c84a6bc3078c79", features = ["std", "_test_utils"] }
105105
#lightning = { path = "../rust-lightning/lightning", features = ["std", "_test_utils"] }
106106
proptest = "1.0.0"
107107
regex = "1.5.6"

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,8 @@ impl Node {
635635
return;
636636
}
637637
_ = tokio::time::sleep(Duration::from_secs(HTLC_EXPIRY_CHECK_INTERVAL_SECS)) => {
638-
liquidity_handler.handle_expired_htlcs().await;
638+
liquidity_handler.process_pending_htlcs();
639+
liquidity_handler.handle_expired_htlcs().await;
639640
}
640641
_ = liquidity_handler.handle_next_event() => {}
641642
}

src/liquidity.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,12 @@ where
502502
}
503503
}
504504

505+
pub(crate) fn process_pending_htlcs(&self) {
506+
if let Some(lsps4_service_handler) = self.liquidity_manager.lsps4_service_handler() {
507+
lsps4_service_handler.process_pending_htlcs();
508+
}
509+
}
510+
505511
pub(crate) async fn handle_next_event(&self) {
506512
match self.liquidity_manager.next_event_async().await {
507513
LiquidityEvent::LSPS1Client(LSPS1ClientEvent::SupportedOptionsReady {

0 commit comments

Comments
 (0)