From ad6f5f135f1b8a7fb9db6d024814b76b6837e23d Mon Sep 17 00:00:00 2001 From: optout <13562139+optout21@users.noreply.github.com> Date: Thu, 12 Sep 2024 19:42:03 +0200 Subject: [PATCH] Review fixes --- lightning-invoice/src/de.rs | 13 +++++++------ lightning-types/Cargo.toml | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lightning-invoice/src/de.rs b/lightning-invoice/src/de.rs index 4dce06ece1d..07054aad275 100644 --- a/lightning-invoice/src/de.rs +++ b/lightning-invoice/src/de.rs @@ -79,7 +79,7 @@ impl FromBase32 for PaymentSecret { return Err(Bolt11ParseError::InvalidSliceLength( field_data.len(), 52, - "payment secret", + "PaymentSecret", )); } let data_bytes = <[u8; 32]>::from_base32(field_data)?; @@ -383,10 +383,11 @@ impl FromStr for SignedRawBolt11Invoice { fn from_str(s: &str) -> Result { let parsed = CheckedHrpstring::new::(s)?; let hrp = parsed.hrp(); - // Access original non-packed 32 byte values (as Fe32s) (iterator type is needed for API hack) - let data: Vec<_> = parsed.fe32_iter::>>().collect(); + // Access original non-packed 32 byte values (as Fe32s) + // Note: the type argument is needed due to the API peculiarities, but it's not used + let data: Vec<_> = parsed.fe32_iter::<&mut dyn Iterator>().collect(); - const SIGNATURE_LEN5: usize = 104; // 32-bit values, 65 bytes + const SIGNATURE_LEN5: usize = 104; // number of the 5-bit values (equals to 65 bytes) if data.len() < SIGNATURE_LEN5 { return Err(Bolt11ParseError::TooShortDataPart); } @@ -467,7 +468,7 @@ impl FromBase32 for PositiveTimestamp { return Err(Bolt11ParseError::InvalidSliceLength( b32.len(), 7, - "timestamp", + "PositiveTimestamp", )); } let timestamp: u64 = parse_u64_be(b32) @@ -486,7 +487,7 @@ impl FromBase32 for Bolt11InvoiceSignature { return Err(Bolt11ParseError::InvalidSliceLength( signature.len(), 104, - "signature", + "Bolt11InvoiceSignature", )); } let recoverable_signature_bytes = <[u8; 65]>::from_base32(signature)?; diff --git a/lightning-types/Cargo.toml b/lightning-types/Cargo.toml index 46e98f7b413..768b8fb3d90 100644 --- a/lightning-types/Cargo.toml +++ b/lightning-types/Cargo.toml @@ -17,7 +17,6 @@ _test_utils = [] [dependencies] bitcoin = { version = "0.32.2", default-features = false } -bech32 = { version = "0.11.0", default-features = false } [lints] workspace = true