Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cut 0.0.122 with just #2969, #2897, and #2937 #2985

19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# 0.0.122 - Apr 09, 2024 - "That Which Is Untested Is Broken"

## Bug Fixes
* `Route` objects did not successfully round-trip through de/serialization
since LDK 0.0.117, which has now been fixed (#2897).
* Correct deserialization of unknown future enum variants. This ensures
downgrades from future versions of LDK do not result in read failures or
corrupt reads in cases where enums are written (#2969).
* When hitting lnd bug 6039, our workaround previously resulted in
`ChannelManager` persistences on every round-trip with our peer. These
useless persistences are now skipped (#2937).

In total, this release features 4 files changed, 99 insertions, 55
deletions in 6 commits from 1 author, in alphabetical order:
* Matt Corallo


tnull marked this conversation as resolved.
Show resolved Hide resolved
# 0.0.121 - Jan 22, 2024 - "Unwraps are Bad"

## Bug Fixes
Expand All @@ -17,6 +34,7 @@ deletions in 4 commits from 2 authors, in alphabetical order:
* Jeffrey Czyz
* Matt Corallo


# 0.0.120 - Jan 17, 2024 - "Unblinded Fuzzers"

## API Updates
Expand Down Expand Up @@ -65,6 +83,7 @@ deletions in 79 commits from 9 authors, in alphabetical order:
* optout
* shuoer86


# 0.0.119 - Dec 15, 2023 - "Spring Cleaning for Christmas"

## API Updates
Expand Down
12 changes: 6 additions & 6 deletions lightning-background-processor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightning-background-processor"
version = "0.0.121"
version = "0.0.122"
authors = ["Valentine Wallace <vwallace@protonmail.com>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/lightningdevkit/rust-lightning"
Expand All @@ -22,11 +22,11 @@ default = ["std"]

[dependencies]
bitcoin = { version = "0.30.2", default-features = false }
lightning = { version = "0.0.121", path = "../lightning", default-features = false }
lightning-rapid-gossip-sync = { version = "0.0.121", path = "../lightning-rapid-gossip-sync", default-features = false }
lightning = { version = "0.0.122", path = "../lightning", default-features = false }
lightning-rapid-gossip-sync = { version = "0.0.122", path = "../lightning-rapid-gossip-sync", default-features = false }

[dev-dependencies]
tokio = { version = "1.35", features = [ "macros", "rt", "rt-multi-thread", "sync", "time" ] }
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
lightning-invoice = { version = "0.29.0", path = "../lightning-invoice" }
lightning-persister = { version = "0.0.121", path = "../lightning-persister" }
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }
lightning-invoice = { version = "0.30.0", path = "../lightning-invoice" }
lightning-persister = { version = "0.0.122", path = "../lightning-persister" }
6 changes: 3 additions & 3 deletions lightning-block-sync/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightning-block-sync"
version = "0.0.121"
version = "0.0.122"
authors = ["Jeffrey Czyz", "Matt Corallo"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/lightningdevkit/rust-lightning"
Expand All @@ -20,11 +20,11 @@ rpc-client = [ "serde_json", "chunked_transfer" ]
[dependencies]
bitcoin = "0.30.2"
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
lightning = { version = "0.0.121", path = "../lightning" }
lightning = { version = "0.0.122", path = "../lightning" }
tokio = { version = "1.35", features = [ "io-util", "net", "time", "rt" ], optional = true }
serde_json = { version = "1.0", optional = true }
chunked_transfer = { version = "1.4", optional = true }

[dev-dependencies]
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }
tokio = { version = "1.35", features = [ "macros", "rt" ] }
4 changes: 2 additions & 2 deletions lightning-custom-message/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightning-custom-message"
version = "0.0.121"
version = "0.0.122"
authors = ["Jeffrey Czyz"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/lightningdevkit/rust-lightning"
Expand All @@ -15,4 +15,4 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
bitcoin = "0.30.2"
lightning = { version = "0.0.121", path = "../lightning" }
lightning = { version = "0.0.122", path = "../lightning" }
6 changes: 3 additions & 3 deletions lightning-invoice/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "lightning-invoice"
description = "Data structures to parse and serialize BOLT11 lightning invoices"
version = "0.29.0"
version = "0.30.0"
authors = ["Sebastian Geisler <sgeisler@wh2.tu-dresden.de>"]
documentation = "https://docs.rs/lightning-invoice/"
license = "MIT OR Apache-2.0"
Expand All @@ -21,14 +21,14 @@ std = ["bitcoin/std", "num-traits/std", "lightning/std", "bech32/std"]

[dependencies]
bech32 = { version = "0.9.0", default-features = false }
lightning = { version = "0.0.121", path = "../lightning", default-features = false }
lightning = { version = "0.0.122", path = "../lightning", default-features = false }
secp256k1 = { version = "0.27.0", default-features = false, features = ["recovery", "alloc"] }
num-traits = { version = "0.2.8", default-features = false }
hashbrown = { version = "0.8", optional = true }
serde = { version = "1.0.118", optional = true }
bitcoin = { version = "0.30.2", default-features = false }

[dev-dependencies]
lightning = { version = "0.0.121", path = "../lightning", default-features = false, features = ["_test_utils"] }
lightning = { version = "0.0.122", path = "../lightning", default-features = false, features = ["_test_utils"] }
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
serde_json = { version = "1"}
6 changes: 3 additions & 3 deletions lightning-net-tokio/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightning-net-tokio"
version = "0.0.121"
version = "0.0.122"
authors = ["Matt Corallo"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/lightningdevkit/rust-lightning/"
Expand All @@ -16,9 +16,9 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
bitcoin = "0.30.2"
lightning = { version = "0.0.121", path = "../lightning" }
lightning = { version = "0.0.122", path = "../lightning" }
tokio = { version = "1.35", features = [ "rt", "sync", "net", "time" ] }

[dev-dependencies]
tokio = { version = "1.35", features = [ "macros", "rt", "rt-multi-thread", "sync", "net", "time" ] }
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }
6 changes: 3 additions & 3 deletions lightning-persister/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightning-persister"
version = "0.0.121"
version = "0.0.122"
authors = ["Valentine Wallace", "Matt Corallo"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/lightningdevkit/rust-lightning"
Expand All @@ -15,7 +15,7 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
bitcoin = "0.30.2"
lightning = { version = "0.0.121", path = "../lightning" }
lightning = { version = "0.0.122", path = "../lightning" }

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.48.0", default-features = false, features = ["Win32_Storage_FileSystem", "Win32_Foundation"] }
Expand All @@ -24,5 +24,5 @@ windows-sys = { version = "0.48.0", default-features = false, features = ["Win32
criterion = { version = "0.4", optional = true, default-features = false }

[dev-dependencies]
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }
bitcoin = { version = "0.30.2", default-features = false }
6 changes: 3 additions & 3 deletions lightning-rapid-gossip-sync/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightning-rapid-gossip-sync"
version = "0.0.121"
version = "0.0.122"
authors = ["Arik Sosman <git@arik.io>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/lightningdevkit/rust-lightning"
Expand All @@ -15,11 +15,11 @@ no-std = ["lightning/no-std"]
std = ["lightning/std"]

[dependencies]
lightning = { version = "0.0.121", path = "../lightning", default-features = false }
lightning = { version = "0.0.122", path = "../lightning", default-features = false }
bitcoin = { version = "0.30.2", default-features = false }

[target.'cfg(ldk_bench)'.dependencies]
criterion = { version = "0.4", optional = true, default-features = false }

[dev-dependencies]
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }
6 changes: 3 additions & 3 deletions lightning-transaction-sync/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightning-transaction-sync"
version = "0.0.121"
version = "0.0.122"
authors = ["Elias Rohrer"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/lightningdevkit/rust-lightning"
Expand All @@ -23,15 +23,15 @@ electrum = ["electrum-client"]
async-interface = []

[dependencies]
lightning = { version = "0.0.121", path = "../lightning", default-features = false, features = ["std"] }
lightning = { version = "0.0.122", path = "../lightning", default-features = false, features = ["std"] }
bitcoin = { version = "0.30.2", default-features = false }
bdk-macros = "0.6"
futures = { version = "0.3", optional = true }
esplora-client = { version = "0.6", default-features = false, optional = true }
electrum-client = { version = "0.18.0", optional = true }

[dev-dependencies]
lightning = { version = "0.0.121", path = "../lightning", default-features = false, features = ["std", "_test_utils"] }
lightning = { version = "0.0.122", path = "../lightning", default-features = false, features = ["std", "_test_utils"] }
tokio = { version = "1.35.0", features = ["full"] }

[target.'cfg(not(no_download))'.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion lightning/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightning"
version = "0.0.121"
version = "0.0.122"
authors = ["Matt Corallo"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/lightningdevkit/rust-lightning/"
Expand Down
6 changes: 5 additions & 1 deletion lightning/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ pub use std::io;
pub use core2::io;

#[cfg(not(feature = "std"))]
mod io_extras {
#[doc(hidden)]
/// IO utilities public only for use by in-crate macros. These should not be used externally
pub mod io_extras {
use core2::io::{self, Read, Write};

/// A writer which will move data into the void.
Expand Down Expand Up @@ -154,6 +156,8 @@ mod io_extras {
}

#[cfg(feature = "std")]
#[doc(hidden)]
/// IO utilities public only for use by in-crate macros. These should not be used externally
mod io_extras {
pub fn read_to_end<D: ::std::io::Read>(mut d: D) -> Result<Vec<u8>, ::std::io::Error> {
let mut buf = Vec::new();
Expand Down
55 changes: 32 additions & 23 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9030,8 +9030,6 @@ where
}

fn handle_error(&self, counterparty_node_id: &PublicKey, msg: &msgs::ErrorMessage) {
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);

match &msg.data as &str {
"cannot co-op close channel w/ active htlcs"|
"link failed to shutdown" =>
Expand All @@ -9044,34 +9042,45 @@ where
// We're not going to bother handling this in a sensible way, instead simply
// repeating the Shutdown message on repeat until morale improves.
if !msg.channel_id.is_zero() {
let per_peer_state = self.per_peer_state.read().unwrap();
let peer_state_mutex_opt = per_peer_state.get(counterparty_node_id);
if peer_state_mutex_opt.is_none() { return; }
let mut peer_state = peer_state_mutex_opt.unwrap().lock().unwrap();
if let Some(ChannelPhase::Funded(chan)) = peer_state.channel_by_id.get(&msg.channel_id) {
if let Some(msg) = chan.get_outbound_shutdown() {
peer_state.pending_msg_events.push(events::MessageSendEvent::SendShutdown {
node_id: *counterparty_node_id,
msg,
});
}
peer_state.pending_msg_events.push(events::MessageSendEvent::HandleError {
node_id: *counterparty_node_id,
action: msgs::ErrorAction::SendWarningMessage {
msg: msgs::WarningMessage {
channel_id: msg.channel_id,
data: "You appear to be exhibiting LND bug 6039, we'll keep sending you shutdown messages until you handle them correctly".to_owned()
},
log_level: Level::Trace,
PersistenceNotifierGuard::optionally_notify(
self,
|| -> NotifyOption {
let per_peer_state = self.per_peer_state.read().unwrap();
let peer_state_mutex_opt = per_peer_state.get(counterparty_node_id);
if peer_state_mutex_opt.is_none() { return NotifyOption::SkipPersistNoEvents; }
let mut peer_state = peer_state_mutex_opt.unwrap().lock().unwrap();
if let Some(ChannelPhase::Funded(chan)) = peer_state.channel_by_id.get(&msg.channel_id) {
if let Some(msg) = chan.get_outbound_shutdown() {
peer_state.pending_msg_events.push(events::MessageSendEvent::SendShutdown {
node_id: *counterparty_node_id,
msg,
});
}
peer_state.pending_msg_events.push(events::MessageSendEvent::HandleError {
node_id: *counterparty_node_id,
action: msgs::ErrorAction::SendWarningMessage {
msg: msgs::WarningMessage {
channel_id: msg.channel_id,
data: "You appear to be exhibiting LND bug 6039, we'll keep sending you shutdown messages until you handle them correctly".to_owned()
},
log_level: Level::Trace,
}
});
// This can happen in a fairly tight loop, so we absolutely cannot trigger
// a `ChannelManager` write here.
return NotifyOption::SkipPersistHandleEvents;
}
});
}
NotifyOption::SkipPersistNoEvents
}
);
}
return;
}
_ => {}
}

let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);

if msg.channel_id.is_zero() {
let channel_ids: Vec<ChannelId> = {
let per_peer_state = self.per_peer_state.read().unwrap();
Expand Down
24 changes: 12 additions & 12 deletions lightning/src/routing/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,28 +508,28 @@ impl Writeable for Route {
write_ver_prefix!(writer, SERIALIZATION_VERSION, MIN_SERIALIZATION_VERSION);
(self.paths.len() as u64).write(writer)?;
let mut blinded_tails = Vec::new();
for path in self.paths.iter() {
for (idx, path) in self.paths.iter().enumerate() {
(path.hops.len() as u8).write(writer)?;
for (idx, hop) in path.hops.iter().enumerate() {
for hop in path.hops.iter() {
hop.write(writer)?;
if let Some(blinded_tail) = &path.blinded_tail {
if blinded_tails.is_empty() {
blinded_tails = Vec::with_capacity(path.hops.len());
for _ in 0..idx {
blinded_tails.push(None);
}
}
blinded_tails.push(Some(blinded_tail));
} else if !blinded_tails.is_empty() { blinded_tails.push(None); }
}
if let Some(blinded_tail) = &path.blinded_tail {
if blinded_tails.is_empty() {
blinded_tails = Vec::with_capacity(path.hops.len());
for _ in 0..idx {
blinded_tails.push(None);
}
}
blinded_tails.push(Some(blinded_tail));
} else if !blinded_tails.is_empty() { blinded_tails.push(None); }
}
write_tlv_fields!(writer, {
// For compatibility with LDK versions prior to 0.0.117, we take the individual
// RouteParameters' fields and reconstruct them on read.
(1, self.route_params.as_ref().map(|p| &p.payment_params), option),
(2, blinded_tails, optional_vec),
(3, self.route_params.as_ref().map(|p| p.final_value_msat), option),
(5, self.route_params.as_ref().map(|p| p.max_total_routing_fee_msat), option),
(5, self.route_params.as_ref().and_then(|p| p.max_total_routing_fee_msat), option),
});
Ok(())
}
Expand Down