Skip to content

Commit 7dd5a3d

Browse files
committed
remove unused code
1 parent afadc61 commit 7dd5a3d

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

lightning/src/util/base32.rs

+3-30
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ impl Alphabet {
123123
// decodable, treat the string as invalid.
124124
return Err(());
125125
}
126-
let mut ret = Self::decode_data((data.len() + 7) / 8 * 5, data, &ZBASE_INV_ALPHABET)?;
126+
let cap = (data.len() + 7) / 8 * 5;
127+
let mut ret = Self::decode_data(cap, data, &ZBASE_INV_ALPHABET)?;
127128
for c in ret.drain(output_length..) {
128129
if c != 0 {
129130
// If the original string had any bits set at positions outside of the encoded data,
@@ -133,7 +134,7 @@ impl Alphabet {
133134
}
134135
// Check that our capacity calculation doesn't under-shoot in fuzzing
135136
#[cfg(fuzzing)]
136-
assert_eq!(ret.capacity(), (data.len() + 7) / 8 * 5);
137+
assert_eq!(ret.capacity(), cap);
137138
Ok(ret)
138139
}
139140

@@ -183,34 +184,6 @@ impl Alphabet {
183184
}
184185
}
185186

186-
187-
// /// Encode a byte slice into a base32 string.
188-
// pub fn encode(alphabet: Alphabet, data: &[u8]) -> String {
189-
// let ret = match alphabet {
190-
// Alphabet::RFC4648 { padding } =>{
191-
// rfc4648_encode(data, padding)
192-
// },
193-
// Alphabet::ZBase32 => {
194-
// zbase32_encode(data)
195-
// }
196-
// };
197-
// String::from_utf8(ret).unwrap()
198-
// }
199-
200-
// /// Decode a base32 string into a byte vector.
201-
// pub fn decode(alphabet: Alphabet, data: &str) -> Result<Vec<u8>, ()> {
202-
// let data = data.as_bytes();
203-
// match alphabet {
204-
// Alphabet::RFC4648 { .. } => {
205-
// rfc4648_decode(data)
206-
// },
207-
// Alphabet::ZBase32 => {
208-
// zbase32_decode(data)
209-
// },
210-
// }
211-
// }
212-
213-
214187
#[cfg(test)]
215188
mod tests {
216189
use std::fmt::{Debug, Error, Formatter};

0 commit comments

Comments
 (0)