Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mina86 committed Aug 20, 2024
1 parent e88fc1d commit 4b463ea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions solana/trie-geyser/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ impl GeyserPlugin for Plugin {
return Err(utils::custom_err(msg));
}

let cfg = config::Config::load(config_file.as_ref()).map_err(|err| {
log::error!("{config_file}: {err}");
err
})?;
let cfg =
config::Config::load(config_file.as_ref()).map_err(|err| {
log::error!("{config_file}: {err}");
err
})?;
let (sender, receiver) = crossbeam_channel::unbounded();
let thread = std::thread::Builder::new()
.name("witnessed-trie-worker".into())
Expand Down
3 changes: 2 additions & 1 deletion solana/trie-geyser/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ impl MerkleProof {
} else {
accounts.par_sort_unstable_by(|a, b| a.0.cmp(&b.0));
}
let pos = accounts.binary_search_by_key(&pubkey, |item| &item.0).ok()?;
let pos =
accounts.binary_search_by_key(&pubkey, |item| &item.0).ok()?;
let root = compute_merkle_root(accounts);
let proof = generate_merkle_proof(accounts, pos);
Some((root, proof))
Expand Down
13 changes: 6 additions & 7 deletions solana/trie-geyser/src/worker.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::collections::{BTreeMap, HashMap};

use cf_solana::proof::AccountHashData;
use solana_accounts_db::accounts_hash::AccountHash;
use solana_sdk::hash::Hash;
use solana_sdk::pubkey::Pubkey;

use cf_solana::proof::AccountHashData;

use crate::{config, proof, types, utils};

/// Message sent from the plugin to the worker thread.
Expand Down Expand Up @@ -167,11 +166,11 @@ impl Worker {

// Calculate Account Delta Hash (Merkle Root) and Merkle proofs for
// witness account.
let (accounts_delta_hash, account_proof) =
proof::MerkleProof::new(
&mut account_hashes,
&self.config.witness_account,
).unwrap();
let (accounts_delta_hash, account_proof) = proof::MerkleProof::new(
&mut account_hashes,
&self.config.witness_account,
)
.unwrap();

// Calculate BankHash based on accounts_delta_hash and information
// extracted in Step 2
Expand Down

0 comments on commit 4b463ea

Please sign in to comment.