This commit is contained in:
Simon Gardling
2022-05-17 10:15:45 -04:00
parent 149adfd614
commit 4227437475
4 changed files with 19 additions and 18 deletions

View File

@@ -324,7 +324,7 @@ pub fn hashed_storage_create(hash: HashBytes, data: &[u8]) -> String {
}
#[allow(dead_code)]
pub fn hashed_storage_read(data: String) -> Option<(HashBytes, Vec<u8>)> {
pub fn hashed_storage_read(data: &str) -> Option<(HashBytes, Vec<u8>)> {
if HASH_LENGTH >= data.len() {
return None;
}
@@ -335,6 +335,7 @@ pub fn hashed_storage_read(data: String) -> Option<(HashBytes, Vec<u8>)> {
}
// can't use data.as_bytes() here for some reason, seems to break on wasm?
// Other memory trickery seems to not worm on wasm. so I was unable to implement a more effecient manner of doing this
let decoded_1 = data.chars().map(|c| c as u8).collect::<Vec<u8>>();
let (hash, cached_data) = {