You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v0.1.2 - Apr 02, 2025 - "Foolishly Edgy Cases"
API Updates
===========
* `lightning-invoice` is now re-exported as `lightning::bolt11_invoice`
(lightningdevkit#3671).
Performance Improvements
========================
* `rapid-gossip-sync` graph parsing is substantially faster, resolving a
regression in 0.1 (lightningdevkit#3581).
* `NetworkGraph` loading is now substantially faster and does fewer
allocations, resulting in a 20% further improvement in `rapid-gossip-sync`
loading when initializing from scratch (lightningdevkit#3581).
* `ChannelMonitor`s for closed channels are no longer always re-persisted
immediately after startup, reducing on-startup I/O burden (lightningdevkit#3619).
Bug Fixes
=========
* BOLT 11 invoices longer than 1023 bytes long (and up to 7089 bytes) now
properly parse (lightningdevkit#3665).
* In some cases, when using synchronous persistence with higher latency than
the latency to communicate with peers, when receiving an MPP payment with
multiple parts received over the same channel, a channel could hang and not
make progress, eventually leading to a force-closure due to timed-out HTLCs.
This has now been fixed (lightningdevkit#3680).
* Some rare cases with multi-hop BOLT 11 route hints or multiple redundant
blinded paths could have led to the router creating invalid `Route`s were
fixed (lightningdevkit#3586).
* Corrected the decay logic in `ProbabilisticScorer`'s historical buckets
model. Note that by default historical buckets are only decayed if no new
datapoints have been added for a channel for two weeks (lightningdevkit#3562).
* `{Channel,Onion}MessageHandler::peer_disconnected` will now be called if a
different message handler refused connection by returning an `Err` from its
`peer_connected` method (lightningdevkit#3580).
* If the counterparty broadcasts a revoked state with pending HTLCs, those
will now be claimed with other outputs which we consider to not be
vulnerable to pinning attacks if they are not yet claimable by our
counterparty, potentially reducing our exposure to pinning attacks (lightningdevkit#3564).
Copy file name to clipboardExpand all lines: lightning-invoice/src/de.rs
+243-2Lines changed: 243 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,10 @@ use core::str::FromStr;
9
9
use std::error;
10
10
11
11
use bech32::primitives::decode::{CheckedHrpstring,CheckedHrpstringError};
12
-
use bech32::{Bech32,Fe32,Fe32IterExt};
12
+
use bech32::{Fe32,Fe32IterExt};
13
13
14
14
usecrate::prelude::*;
15
+
usecrate::Bolt11Bech32;
15
16
use bitcoin::hashes::sha256;
16
17
use bitcoin::hashes::Hash;
17
18
use bitcoin::{PubkeyHash,ScriptHash,WitnessVersion};
@@ -377,7 +378,7 @@ impl FromStr for SignedRawBolt11Invoice {
377
378
typeErr = Bolt11ParseError;
378
379
379
380
fnfrom_str(s:&str) -> Result<Self,Self::Err>{
380
-
let parsed = CheckedHrpstring::new::<Bech32>(s)?;
381
+
let parsed = CheckedHrpstring::new::<Bolt11Bech32>(s)?;
381
382
let hrp = parsed.hrp();
382
383
// Access original non-packed 32 byte values (as Fe32s)
383
384
// Note: the type argument is needed due to the API peculiarities, but it's not used
@@ -1175,4 +1176,244 @@ mod test {
1175
1176
)
1176
1177
)
1177
1178
}
1179
+
1180
+
// Test some long invoice test vectors successfully roundtrip. Generated
1181
+
// from Lexe proptest: <https://github.com/lexe-app/lexe-public/blob/4bc7018307e5221e1e1ee8b17ce366338fb11a16/common/src/ln/invoice.rs#L183>.
1182
+
#[test]
1183
+
fntest_deser_long_test_vectors(){
1184
+
usecrate::Bolt11Invoice;
1185
+
1186
+
#[track_caller]
1187
+
fnparse_ok(invoice_str:&str){
1188
+
let invoice = Bolt11Invoice::from_str(invoice_str).unwrap();
1189
+
let invoice_str2 = invoice.to_string();
1190
+
if invoice_str != invoice_str2 {
1191
+
panic!(
1192
+
"Invoice does not roundtrip: invoice_str != invoice_str2\n\
1193
+
invoice_str: {invoice_str}\n\
1194
+
invoice_str2: {invoice_str2}\n\
1195
+
\n\
1196
+
{invoice:?}"
1197
+
);
1198
+
}
1199
+
}
1200
+
1201
+
// 1024 B shrunk invoice just above previous limit of 1023 B from Lexe proptest
0 commit comments