Skip to content

Commit 27e5519

Browse files
authored
Merge pull request #2985 from TheBlueMatt/2024-03-fix-upgradable-enum-121
Cut 0.0.122 with just #2969, #2897, and #2937
2 parents 4bab9c8 + 66ebe7e commit 27e5519

File tree

14 files changed

+145
-82
lines changed

14 files changed

+145
-82
lines changed

Diff for: CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# 0.0.122 - Apr 09, 2024 - "That Which Is Untested Is Broken"
2+
3+
## Bug Fixes
4+
* `Route` objects did not successfully round-trip through de/serialization
5+
since LDK 0.0.117, which has now been fixed (#2897).
6+
* Correct deserialization of unknown future enum variants. This ensures
7+
downgrades from future versions of LDK do not result in read failures or
8+
corrupt reads in cases where enums are written (#2969).
9+
* When hitting lnd bug 6039, our workaround previously resulted in
10+
`ChannelManager` persistences on every round-trip with our peer. These
11+
useless persistences are now skipped (#2937).
12+
13+
In total, this release features 4 files changed, 99 insertions, 55
14+
deletions in 6 commits from 1 author, in alphabetical order:
15+
* Matt Corallo
16+
17+
118
# 0.0.121 - Jan 22, 2024 - "Unwraps are Bad"
219

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

37+
2038
# 0.0.120 - Jan 17, 2024 - "Unblinded Fuzzers"
2139

2240
## API Updates
@@ -65,6 +83,7 @@ deletions in 79 commits from 9 authors, in alphabetical order:
6583
* optout
6684
* shuoer86
6785

86+
6887
# 0.0.119 - Dec 15, 2023 - "Spring Cleaning for Christmas"
6988

7089
## API Updates

Diff for: lightning-background-processor/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-background-processor"
3-
version = "0.0.121"
3+
version = "0.0.122"
44
authors = ["Valentine Wallace <[email protected]>"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -22,11 +22,11 @@ default = ["std"]
2222

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

2828
[dev-dependencies]
2929
tokio = { version = "1.35", features = [ "macros", "rt", "rt-multi-thread", "sync", "time" ] }
30-
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
31-
lightning-invoice = { version = "0.29.0", path = "../lightning-invoice" }
32-
lightning-persister = { version = "0.0.121", path = "../lightning-persister" }
30+
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }
31+
lightning-invoice = { version = "0.30.0", path = "../lightning-invoice" }
32+
lightning-persister = { version = "0.0.122", path = "../lightning-persister" }

Diff for: lightning-block-sync/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-block-sync"
3-
version = "0.0.121"
3+
version = "0.0.122"
44
authors = ["Jeffrey Czyz", "Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -20,11 +20,11 @@ rpc-client = [ "serde_json", "chunked_transfer" ]
2020
[dependencies]
2121
bitcoin = "0.30.2"
2222
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
23-
lightning = { version = "0.0.121", path = "../lightning" }
23+
lightning = { version = "0.0.122", path = "../lightning" }
2424
tokio = { version = "1.35", features = [ "io-util", "net", "time", "rt" ], optional = true }
2525
serde_json = { version = "1.0", optional = true }
2626
chunked_transfer = { version = "1.4", optional = true }
2727

2828
[dev-dependencies]
29-
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
29+
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }
3030
tokio = { version = "1.35", features = [ "macros", "rt" ] }

Diff for: lightning-custom-message/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-custom-message"
3-
version = "0.0.121"
3+
version = "0.0.122"
44
authors = ["Jeffrey Czyz"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -15,4 +15,4 @@ rustdoc-args = ["--cfg", "docsrs"]
1515

1616
[dependencies]
1717
bitcoin = "0.30.2"
18-
lightning = { version = "0.0.121", path = "../lightning" }
18+
lightning = { version = "0.0.122", path = "../lightning" }

Diff for: lightning-invoice/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "lightning-invoice"
33
description = "Data structures to parse and serialize BOLT11 lightning invoices"
4-
version = "0.29.0"
4+
version = "0.30.0"
55
authors = ["Sebastian Geisler <[email protected]>"]
66
documentation = "https://docs.rs/lightning-invoice/"
77
license = "MIT OR Apache-2.0"
@@ -21,14 +21,14 @@ std = ["bitcoin/std", "num-traits/std", "lightning/std", "bech32/std"]
2121

2222
[dependencies]
2323
bech32 = { version = "0.9.0", default-features = false }
24-
lightning = { version = "0.0.121", path = "../lightning", default-features = false }
24+
lightning = { version = "0.0.122", path = "../lightning", default-features = false }
2525
secp256k1 = { version = "0.27.0", default-features = false, features = ["recovery", "alloc"] }
2626
num-traits = { version = "0.2.8", default-features = false }
2727
hashbrown = { version = "0.8", optional = true }
2828
serde = { version = "1.0.118", optional = true }
2929
bitcoin = { version = "0.30.2", default-features = false }
3030

3131
[dev-dependencies]
32-
lightning = { version = "0.0.121", path = "../lightning", default-features = false, features = ["_test_utils"] }
32+
lightning = { version = "0.0.122", path = "../lightning", default-features = false, features = ["_test_utils"] }
3333
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
3434
serde_json = { version = "1"}

Diff for: lightning-net-tokio/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-net-tokio"
3-
version = "0.0.121"
3+
version = "0.0.122"
44
authors = ["Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning/"
@@ -16,9 +16,9 @@ rustdoc-args = ["--cfg", "docsrs"]
1616

1717
[dependencies]
1818
bitcoin = "0.30.2"
19-
lightning = { version = "0.0.121", path = "../lightning" }
19+
lightning = { version = "0.0.122", path = "../lightning" }
2020
tokio = { version = "1.35", features = [ "rt", "sync", "net", "time" ] }
2121

2222
[dev-dependencies]
2323
tokio = { version = "1.35", features = [ "macros", "rt", "rt-multi-thread", "sync", "net", "time" ] }
24-
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
24+
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }

Diff for: lightning-persister/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-persister"
3-
version = "0.0.121"
3+
version = "0.0.122"
44
authors = ["Valentine Wallace", "Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -15,7 +15,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1515

1616
[dependencies]
1717
bitcoin = "0.30.2"
18-
lightning = { version = "0.0.121", path = "../lightning" }
18+
lightning = { version = "0.0.122", path = "../lightning" }
1919

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

2626
[dev-dependencies]
27-
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
27+
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }
2828
bitcoin = { version = "0.30.2", default-features = false }

Diff for: lightning-rapid-gossip-sync/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-rapid-gossip-sync"
3-
version = "0.0.121"
3+
version = "0.0.122"
44
authors = ["Arik Sosman <[email protected]>"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -15,11 +15,11 @@ no-std = ["lightning/no-std"]
1515
std = ["lightning/std"]
1616

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

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

2424
[dev-dependencies]
25-
lightning = { version = "0.0.121", path = "../lightning", features = ["_test_utils"] }
25+
lightning = { version = "0.0.122", path = "../lightning", features = ["_test_utils"] }

Diff for: lightning-transaction-sync/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-transaction-sync"
3-
version = "0.0.121"
3+
version = "0.0.122"
44
authors = ["Elias Rohrer"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -23,15 +23,15 @@ electrum = ["electrum-client"]
2323
async-interface = []
2424

2525
[dependencies]
26-
lightning = { version = "0.0.121", path = "../lightning", default-features = false, features = ["std"] }
26+
lightning = { version = "0.0.122", path = "../lightning", default-features = false, features = ["std"] }
2727
bitcoin = { version = "0.30.2", default-features = false }
2828
bdk-macros = "0.6"
2929
futures = { version = "0.3", optional = true }
3030
esplora-client = { version = "0.6", default-features = false, optional = true }
3131
electrum-client = { version = "0.18.0", optional = true }
3232

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

3737
[target.'cfg(not(no_download))'.dev-dependencies]

Diff for: lightning/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning"
3-
version = "0.0.121"
3+
version = "0.0.122"
44
authors = ["Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning/"

Diff for: lightning/src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ pub use std::io;
9494
pub use core2::io;
9595

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

100102
/// A writer which will move data into the void.
@@ -154,6 +156,8 @@ mod io_extras {
154156
}
155157

156158
#[cfg(feature = "std")]
159+
#[doc(hidden)]
160+
/// IO utilities public only for use by in-crate macros. These should not be used externally
157161
mod io_extras {
158162
pub fn read_to_end<D: ::std::io::Read>(mut d: D) -> Result<Vec<u8>, ::std::io::Error> {
159163
let mut buf = Vec::new();

Diff for: lightning/src/ln/channelmanager.rs

+32-23
Original file line numberDiff line numberDiff line change
@@ -9030,8 +9030,6 @@ where
90309030
}
90319031

90329032
fn handle_error(&self, counterparty_node_id: &PublicKey, msg: &msgs::ErrorMessage) {
9033-
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
9034-
90359033
match &msg.data as &str {
90369034
"cannot co-op close channel w/ active htlcs"|
90379035
"link failed to shutdown" =>
@@ -9044,34 +9042,45 @@ where
90449042
// We're not going to bother handling this in a sensible way, instead simply
90459043
// repeating the Shutdown message on repeat until morale improves.
90469044
if !msg.channel_id.is_zero() {
9047-
let per_peer_state = self.per_peer_state.read().unwrap();
9048-
let peer_state_mutex_opt = per_peer_state.get(counterparty_node_id);
9049-
if peer_state_mutex_opt.is_none() { return; }
9050-
let mut peer_state = peer_state_mutex_opt.unwrap().lock().unwrap();
9051-
if let Some(ChannelPhase::Funded(chan)) = peer_state.channel_by_id.get(&msg.channel_id) {
9052-
if let Some(msg) = chan.get_outbound_shutdown() {
9053-
peer_state.pending_msg_events.push(events::MessageSendEvent::SendShutdown {
9054-
node_id: *counterparty_node_id,
9055-
msg,
9056-
});
9057-
}
9058-
peer_state.pending_msg_events.push(events::MessageSendEvent::HandleError {
9059-
node_id: *counterparty_node_id,
9060-
action: msgs::ErrorAction::SendWarningMessage {
9061-
msg: msgs::WarningMessage {
9062-
channel_id: msg.channel_id,
9063-
data: "You appear to be exhibiting LND bug 6039, we'll keep sending you shutdown messages until you handle them correctly".to_owned()
9064-
},
9065-
log_level: Level::Trace,
9045+
PersistenceNotifierGuard::optionally_notify(
9046+
self,
9047+
|| -> NotifyOption {
9048+
let per_peer_state = self.per_peer_state.read().unwrap();
9049+
let peer_state_mutex_opt = per_peer_state.get(counterparty_node_id);
9050+
if peer_state_mutex_opt.is_none() { return NotifyOption::SkipPersistNoEvents; }
9051+
let mut peer_state = peer_state_mutex_opt.unwrap().lock().unwrap();
9052+
if let Some(ChannelPhase::Funded(chan)) = peer_state.channel_by_id.get(&msg.channel_id) {
9053+
if let Some(msg) = chan.get_outbound_shutdown() {
9054+
peer_state.pending_msg_events.push(events::MessageSendEvent::SendShutdown {
9055+
node_id: *counterparty_node_id,
9056+
msg,
9057+
});
9058+
}
9059+
peer_state.pending_msg_events.push(events::MessageSendEvent::HandleError {
9060+
node_id: *counterparty_node_id,
9061+
action: msgs::ErrorAction::SendWarningMessage {
9062+
msg: msgs::WarningMessage {
9063+
channel_id: msg.channel_id,
9064+
data: "You appear to be exhibiting LND bug 6039, we'll keep sending you shutdown messages until you handle them correctly".to_owned()
9065+
},
9066+
log_level: Level::Trace,
9067+
}
9068+
});
9069+
// This can happen in a fairly tight loop, so we absolutely cannot trigger
9070+
// a `ChannelManager` write here.
9071+
return NotifyOption::SkipPersistHandleEvents;
90669072
}
9067-
});
9068-
}
9073+
NotifyOption::SkipPersistNoEvents
9074+
}
9075+
);
90699076
}
90709077
return;
90719078
}
90729079
_ => {}
90739080
}
90749081

9082+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
9083+
90759084
if msg.channel_id.is_zero() {
90769085
let channel_ids: Vec<ChannelId> = {
90779086
let per_peer_state = self.per_peer_state.read().unwrap();

Diff for: lightning/src/routing/router.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -508,28 +508,28 @@ impl Writeable for Route {
508508
write_ver_prefix!(writer, SERIALIZATION_VERSION, MIN_SERIALIZATION_VERSION);
509509
(self.paths.len() as u64).write(writer)?;
510510
let mut blinded_tails = Vec::new();
511-
for path in self.paths.iter() {
511+
for (idx, path) in self.paths.iter().enumerate() {
512512
(path.hops.len() as u8).write(writer)?;
513-
for (idx, hop) in path.hops.iter().enumerate() {
513+
for hop in path.hops.iter() {
514514
hop.write(writer)?;
515-
if let Some(blinded_tail) = &path.blinded_tail {
516-
if blinded_tails.is_empty() {
517-
blinded_tails = Vec::with_capacity(path.hops.len());
518-
for _ in 0..idx {
519-
blinded_tails.push(None);
520-
}
521-
}
522-
blinded_tails.push(Some(blinded_tail));
523-
} else if !blinded_tails.is_empty() { blinded_tails.push(None); }
524515
}
516+
if let Some(blinded_tail) = &path.blinded_tail {
517+
if blinded_tails.is_empty() {
518+
blinded_tails = Vec::with_capacity(path.hops.len());
519+
for _ in 0..idx {
520+
blinded_tails.push(None);
521+
}
522+
}
523+
blinded_tails.push(Some(blinded_tail));
524+
} else if !blinded_tails.is_empty() { blinded_tails.push(None); }
525525
}
526526
write_tlv_fields!(writer, {
527527
// For compatibility with LDK versions prior to 0.0.117, we take the individual
528528
// RouteParameters' fields and reconstruct them on read.
529529
(1, self.route_params.as_ref().map(|p| &p.payment_params), option),
530530
(2, blinded_tails, optional_vec),
531531
(3, self.route_params.as_ref().map(|p| p.final_value_msat), option),
532-
(5, self.route_params.as_ref().map(|p| p.max_total_routing_fee_msat), option),
532+
(5, self.route_params.as_ref().and_then(|p| p.max_total_routing_fee_msat), option),
533533
});
534534
Ok(())
535535
}

0 commit comments

Comments
 (0)