Skip to content

Commit 4024abf

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 13eece7 commit 4024abf

3 files changed

Lines changed: 22 additions & 15 deletions

File tree

Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ default = []
4141
# lightning-liquidity = { version = "0.2.0", features = ["std"] }
4242
# lightning-macros = { version = "0.2.0" }
4343

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

5757
#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
5858
#lightning-types = { path = "../rust-lightning/lightning-types" }
@@ -100,8 +100,8 @@ winapi = { version = "0.3", features = ["winbase"] }
100100

101101
[dev-dependencies]
102102
# lightning = { version = "0.2.0", features = ["std", "_test_utils"] }
103-
# Branch: https://github.com/moneydevkit/rust-lightning/commits/lsp-0.2.0/
104-
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "736d3a87bf8f7220a2b2e2e0274bce94d1ae0e2a", features = ["std", "_test_utils"] }
103+
# Branch: https://github.com/moneydevkit/rust-lightning/commits/austin_mdk-608_reprocess-pending-htlcs
104+
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "b7d6a4783aed387ef5abbc9c745a9ff9a72efdcd", 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
@@ -487,6 +487,12 @@ where
487487
}
488488
}
489489

490+
pub(crate) fn process_pending_htlcs(&self) {
491+
if let Some(lsps4_service_handler) = self.liquidity_manager.lsps4_service_handler() {
492+
lsps4_service_handler.process_pending_htlcs();
493+
}
494+
}
495+
490496
pub(crate) async fn handle_next_event(&self) {
491497
match self.liquidity_manager.next_event_async().await {
492498
LiquidityEvent::LSPS1Client(LSPS1ClientEvent::SupportedOptionsReady {

0 commit comments

Comments
 (0)