66f3c50842
* Revert "fix traces, removed bloomchain crate, closes #7228, closes #7167"
This reverts commit 1bf62038678295e5586f02a38a0c5aab9a9efe62.
* Revert "fixed broken logs (#7934)"
This reverts commit f8a2e53f3e
.
* fixed broken logs
* bring back old lock order
* remove migration v13
* revert CURRENT_VERSION to 12 in migration.rs
25 lines
818 B
Rust
25 lines
818 B
Rust
use std::io::{BufReader, Read, BufRead};
|
|
use bloomchain::Bloom;
|
|
use super::FromHex;
|
|
|
|
pub fn for_each_bloom<F>(bytes: &[u8], mut f: F) where F: FnMut(usize, Bloom) {
|
|
let mut reader = BufReader::new(bytes);
|
|
let mut line = String::new();
|
|
while reader.read_line(&mut line).unwrap() > 0 {
|
|
{
|
|
let mut number_bytes = vec![];
|
|
let mut bloom_bytes = [0; 512];
|
|
|
|
let mut line_reader = BufReader::new(line.as_ref() as &[u8]);
|
|
line_reader.read_until(b' ', &mut number_bytes).unwrap();
|
|
line_reader.consume(2);
|
|
line_reader.read_exact(&mut bloom_bytes).unwrap();
|
|
|
|
let number = String::from_utf8(number_bytes).map(|s| s[..s.len() -1].to_owned()).unwrap().parse::<usize>().unwrap();
|
|
let bloom = Bloom::from_hex(&String::from_utf8(bloom_bytes.to_vec()).unwrap());
|
|
f(number, bloom);
|
|
}
|
|
line.clear();
|
|
}
|
|
}
|