Skip to content

Commit 52c3616

Browse files
committed
Bump LDK dependency for SpliceFailed event
A splice's contributed inputs and outputs were moved from the SpliceFailed event to the DiscardFunding event under a new FundingInfo variant. Move the handling of reclaiming unused addresses to the DiscardFunding handler.
1 parent 4cb0054 commit 52c3616

File tree

2 files changed

+35
-27
lines changed

2 files changed

+35
-27
lines changed

Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ default = []
3939
#lightning-liquidity = { version = "0.2.0", features = ["std"] }
4040
#lightning-macros = { version = "0.2.0" }
4141

42-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5", features = ["std"] }
43-
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5" }
44-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5", features = ["std"] }
45-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5" }
46-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5", features = ["tokio"] }
47-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5" }
48-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5" }
49-
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5", features = ["rest-client", "rpc-client", "tokio"] }
50-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
51-
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5", features = ["std"] }
52-
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5" }
42+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245", features = ["std"] }
43+
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245" }
44+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245", features = ["std"] }
45+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245" }
46+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245", features = ["tokio"] }
47+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245" }
48+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245" }
49+
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245", features = ["rest-client", "rpc-client", "tokio"] }
50+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
51+
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245", features = ["std"] }
52+
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245" }
5353

5454
bdk_chain = { version = "0.23.0", default-features = false, features = ["std"] }
5555
bdk_esplora = { version = "0.22.0", default-features = false, features = ["async-https-rustls", "tokio"]}
@@ -78,13 +78,13 @@ log = { version = "0.4.22", default-features = false, features = ["std"]}
7878
vss-client = { package = "vss-client-ng", version = "0.5" }
7979
prost = { version = "0.11.6", default-features = false}
8080
#bitcoin-payment-instructions = { version = "0.6" }
81-
bitcoin-payment-instructions = { git = "https://github.com/jkczyz/bitcoin-payment-instructions", rev = "80dcbc2434e11f58024234c4d42f293e9c685bdd" }
81+
bitcoin-payment-instructions = { git = "https://github.com/jkczyz/bitcoin-payment-instructions", rev = "869fd348c3ca0c78f439d2f31181f4d798c6b20e" }
8282

8383
[target.'cfg(windows)'.dependencies]
8484
winapi = { version = "0.3", features = ["winbase"] }
8585

8686
[dev-dependencies]
87-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "df579782e5a7b46e44d68932e71eb7f6e27769c5", features = ["std", "_test_utils"] }
87+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98501d6e5134228c41460dcf786ab53337e41245", features = ["std", "_test_utils"] }
8888
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
8989
proptest = "1.0.0"
9090
regex = "1.5.6"

src/event.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ use bitcoin::secp256k1::PublicKey;
1616
use bitcoin::{Amount, OutPoint};
1717
use lightning::events::bump_transaction::BumpTransactionEvent;
1818
use lightning::events::{
19-
ClosureReason, Event as LdkEvent, PaymentFailureReason, PaymentPurpose, ReplayEvent,
19+
ClosureReason, Event as LdkEvent, FundingInfo, PaymentFailureReason, PaymentPurpose,
20+
ReplayEvent,
2021
};
2122
use lightning::impl_writeable_tlv_based_enum;
2223
use lightning::ln::channelmanager::PaymentId;
@@ -1516,7 +1517,26 @@ where
15161517
},
15171518
};
15181519
},
1519-
LdkEvent::DiscardFunding { .. } => {},
1520+
LdkEvent::DiscardFunding { channel_id, funding_info } => {
1521+
if let FundingInfo::Contribution { inputs: _, outputs } = funding_info {
1522+
log_info!(
1523+
self.logger,
1524+
"Reclaiming unused addresses from channel {} funding",
1525+
channel_id,
1526+
);
1527+
1528+
let tx = bitcoin::Transaction {
1529+
version: bitcoin::transaction::Version::TWO,
1530+
lock_time: bitcoin::absolute::LockTime::ZERO,
1531+
input: vec![],
1532+
output: outputs,
1533+
};
1534+
if let Err(e) = self.wallet.cancel_tx(&tx) {
1535+
log_error!(self.logger, "Failed reclaiming unused addresses: {}", e);
1536+
return Err(ReplayEvent());
1537+
}
1538+
}
1539+
},
15201540
LdkEvent::HTLCIntercepted {
15211541
requested_next_hop_scid,
15221542
intercept_id,
@@ -1746,7 +1766,6 @@ where
17461766
user_channel_id,
17471767
counterparty_node_id,
17481768
abandoned_funding_txo,
1749-
contributed_outputs,
17501769
..
17511770
} => {
17521771
if let Some(funding_txo) = abandoned_funding_txo {
@@ -1766,17 +1785,6 @@ where
17661785
);
17671786
}
17681787

1769-
let tx = bitcoin::Transaction {
1770-
version: bitcoin::transaction::Version::TWO,
1771-
lock_time: bitcoin::absolute::LockTime::ZERO,
1772-
input: vec![],
1773-
output: contributed_outputs,
1774-
};
1775-
if let Err(e) = self.wallet.cancel_tx(&tx) {
1776-
log_error!(self.logger, "Failed reclaiming unused addresses: {}", e);
1777-
return Err(ReplayEvent());
1778-
}
1779-
17801788
let event = Event::SpliceFailed {
17811789
channel_id,
17821790
user_channel_id: UserChannelId(user_channel_id),

0 commit comments

Comments
 (0)