code format

This commit is contained in:
GroovieGermanikus 2023-07-19 09:33:52 +02:00
parent 18397eeab7
commit 37e44aa9b3
4 changed files with 14 additions and 6 deletions

View File

@ -1,3 +1,4 @@
use anyhow::Context;
use log::{info, warn};
use solana_rpc_client::nonblocking::rpc_client::RpcClient;
use solana_rpc_client_api::config::RpcBlockConfig;
@ -14,7 +15,6 @@ use solana_transaction_status::{
UiTransactionStatusMeta,
};
use std::sync::Arc;
use anyhow::Context;
use crate::block_store::{BlockInformation, BlockStore};

View File

@ -1,5 +1,5 @@
use std::{collections::VecDeque, str::FromStr, sync::Arc};
use anyhow::Context;
use std::{collections::VecDeque, str::FromStr, sync::Arc};
use dashmap::DashMap;
use log::warn;
@ -37,7 +37,9 @@ impl LeaderSchedule {
}
pub async fn load_cluster_info(&self, rpc_client: Arc<RpcClient>) -> anyhow::Result<()> {
let cluster_nodes = rpc_client.get_cluster_nodes().await
let cluster_nodes = rpc_client
.get_cluster_nodes()
.await
.context("failed to get cluster nodes")?;
cluster_nodes.iter().for_each(|x| {
if let Ok(pubkey) = Pubkey::from_str(x.pubkey.as_str()) {
@ -80,7 +82,8 @@ impl LeaderSchedule {
let current_leader = (i - first_slot_to_fetch) as usize;
let leader = leaders[current_leader];
if !self.cluster_nodes.contains_key(&leader) {
self.load_cluster_info(rpc_client.clone()).await
self.load_cluster_info(rpc_client.clone())
.await
.context("failed to load cluster info")?;
}

View File

@ -83,7 +83,9 @@ impl LiteBridge {
max_retries: usize,
) -> anyhow::Result<Self> {
let rpc_client = Arc::new(RpcClient::new(rpc_url.clone()));
let current_slot = rpc_client.get_slot().await
let current_slot = rpc_client
.get_slot()
.await
.context("failed to get initial slot")?;
let tx_store = empty_tx_store();

View File

@ -238,7 +238,10 @@ impl BlockListener {
// TODO insert if not exists leader_id into accountaddrs
// fetch cluster time from rpc
let block_time = self.rpc_client.get_block_time(slot).await
let block_time = self
.rpc_client
.get_block_time(slot)
.await
.context("failed to get block time")?;
// fetch local time from blockstore