Skip to content

Commit

Permalink
Merge pull request #291 from tnull/2024-05-upgrade-to-LDK-v0.0.123
Browse files Browse the repository at this point in the history
Upgrade to LDK v0.0.123
  • Loading branch information
tnull authored May 13, 2024
2 parents 640a1fd + be43848 commit 9f27fcb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
20 changes: 9 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ panic = 'abort' # Abort on panic
default = []

[dependencies]
lightning = { version = "0.0.123-beta", features = ["std"] }
lightning-invoice = { version = "0.31.0-beta" }
lightning-net-tokio = { version = "0.0.123-beta" }
lightning-persister = { version = "0.0.123-beta" }
lightning-background-processor = { version = "0.0.123-beta", features = ["futures"] }
lightning-rapid-gossip-sync = { version = "0.0.123-beta" }
lightning-transaction-sync = { version = "0.0.123-beta", features = ["esplora-async-https", "time"] }
#lightning-liquidity = { version = "0.1.0-alpha.1", features = ["std"] }

lightning-liquidity = { git = "https://github.com/tnull/lightning-liquidity", rev = "abf7088c0e03221c0f122e797f34802c9e99a3d4", features = ["std"] }
lightning = { version = "0.0.123", features = ["std"] }
lightning-invoice = { version = "0.31.0" }
lightning-net-tokio = { version = "0.0.123" }
lightning-persister = { version = "0.0.123" }
lightning-background-processor = { version = "0.0.123", features = ["futures"] }
lightning-rapid-gossip-sync = { version = "0.0.123" }
lightning-transaction-sync = { version = "0.0.123", features = ["esplora-async-https", "time"] }
lightning-liquidity = { version = "0.1.0-alpha.4", features = ["std"] }

#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std"] }
#lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
Expand Down Expand Up @@ -79,7 +77,7 @@ prost = { version = "0.11.6", default-features = false}
winapi = { version = "0.3", features = ["winbase"] }

[dev-dependencies]
lightning = { version = "0.0.123-beta", features = ["std", "_test_utils"] }
lightning = { version = "0.0.123", features = ["std", "_test_utils"] }
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std", "_test_utils"] }
electrum-client = { version = "0.15.1", default-features = true }
bitcoincore-rpc = { version = "0.17.0", default-features = false }
Expand Down
7 changes: 6 additions & 1 deletion src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,12 @@ where
}
},
LdkEvent::SpendableOutputs { outputs, channel_id } => {
self.output_sweeper.track_spendable_outputs(outputs, channel_id, true, None)
self.output_sweeper
.track_spendable_outputs(outputs, channel_id, true, None)
.unwrap_or_else(|_| {
log_error!(self.logger, "Failed to track spendable outputs");
panic!("Failed to track spendable outputs");
});
},
LdkEvent::OpenChannelRequest {
temporary_channel_id,
Expand Down
11 changes: 10 additions & 1 deletion src/io/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,16 @@ where
})?;
let descriptors = vec![output.descriptor.clone()];
let spend_delay = Some(best_block.height + 2);
sweeper.track_spendable_outputs(descriptors, output.channel_id, true, spend_delay);
sweeper
.track_spendable_outputs(descriptors, output.channel_id, true, spend_delay)
.map_err(|_| {
log_error!(logger, "Failed to track spendable outputs. Aborting migration, will retry in the future.");
std::io::Error::new(
std::io::ErrorKind::InvalidData,
"Failed to track spendable outputs. Aborting migration, will retry in the future.",
)
})?;

if let Some(tracked_spendable_output) =
sweeper.tracked_spendable_outputs().iter().find(|o| o.descriptor == output.descriptor)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests_cln.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn test_cln() {
let mut rng = thread_rng();
let rand_label: String = (0..7).map(|_| rng.sample(Alphanumeric) as char).collect();
let cln_invoice =
cln_client.invoice(Some(2_500_000), &rand_label, &rand_label, None, None, None).unwrap();
cln_client.invoice(Some(10_000_000), &rand_label, &rand_label, None, None, None).unwrap();
let parsed_invoice = Bolt11Invoice::from_str(&cln_invoice.bolt11).unwrap();

node.send_payment(&parsed_invoice).unwrap();
Expand All @@ -106,7 +106,7 @@ fn test_cln() {

// Send a payment to LDK
let rand_label: String = (0..7).map(|_| rng.sample(Alphanumeric) as char).collect();
let ldk_invoice = node.receive_payment(2_500_000, &rand_label, 3600).unwrap();
let ldk_invoice = node.receive_payment(10_000_000, &rand_label, 3600).unwrap();
cln_client.pay(&ldk_invoice.to_string(), Default::default()).unwrap();
common::expect_event!(node, PaymentReceived);

Expand Down

0 comments on commit 9f27fcb

Please sign in to comment.