Skip to content
Snippets Groups Projects

Consts

Closed Hugo Trentesaux requested to merge hugo into master
3 files
+ 10
11
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 6
10
use crate::{blockchain, state};
use crate::{blockchain, consts, state};
use dup_crypto::keys::{ed25519::PublicKey as Pubkey, PublicKey};
use dup_crypto::keys::{ed25519::PublicKey as Pubkey, PublicKey};
use indicatif::ProgressBar;
use indicatif::ProgressBar;
@@ -64,18 +64,14 @@ impl blockchain::BcReader<Config> for BcDup {
@@ -64,18 +64,14 @@ impl blockchain::BcReader<Config> for BcDup {
impl BcDup {
impl BcDup {
pub fn new() -> Self {
pub fn new() -> Self {
let bar = ProgressBar::new(
let bar = ProgressBar::new(std::fs::read_dir(consts::G1_PATH).unwrap().count() as u64);
std::fs::read_dir("/home/tuxmain/.config/duniter/duniter_default/g1")
.unwrap()
.count() as u64,
);
let mut blocks = Vec::new();
let mut blocks = Vec::new();
for i in 0usize.. {
for i in 0usize.. {
match std::fs::File::open(format!(
let mut path = String::from(consts::G1_PATH);
"/home/tuxmain/.config/duniter/duniter_default/g1/chunk_{}-250.json",
path.push_str(&format!("/chunk_{}-250.json", i));
i
)) {
match std::fs::File::open(path) {
Ok(chunk) => {
Ok(chunk) => {
if let Ok(chunk) = simd_json::from_reader::<_, serde_json::Value>(chunk) {
if let Ok(chunk) = simd_json::from_reader::<_, serde_json::Value>(chunk) {
for block in chunk["blocks"].as_array().unwrap() {
for block in chunk["blocks"].as_array().unwrap() {
Loading