rename block_ to block_and_rpc_ where applicable

This commit is contained in:
Bryan Stitt 2023-08-16 13:20:22 -07:00
parent 5b9ef30e64
commit 36eb520f84
3 changed files with 9 additions and 9 deletions

View File

@ -334,7 +334,7 @@ impl Web3RpcConfig {
block_interval: Duration,
http_client: Option<reqwest::Client>,
blocks_by_hash_cache: BlocksByHashCache,
block_sender: Option<mpsc::UnboundedSender<BlockAndRpc>>,
block_and_rpc_sender: Option<mpsc::UnboundedSender<BlockAndRpc>>,
max_head_block_age: Duration,
) -> anyhow::Result<(Arc<Web3Rpc>, Web3ProxyJoinHandle<()>)> {
if !self.extra.is_empty() {
@ -351,7 +351,7 @@ impl Web3RpcConfig {
server_id,
block_interval,
blocks_by_hash_cache,
block_sender,
block_and_rpc_sender,
max_head_block_age,
)
.await

View File

@ -408,7 +408,7 @@ impl Web3Rpcs {
pub(super) async fn process_incoming_blocks(
&self,
mut block_receiver: mpsc::UnboundedReceiver<BlockAndRpc>,
mut block_and_rpc_receiver: mpsc::UnboundedReceiver<BlockAndRpc>,
) -> Web3ProxyResult<()> {
let mut consensus_finder =
ConsensusFinder::new(Some(self.max_head_block_age), Some(self.max_head_block_lag));
@ -419,7 +419,7 @@ impl Web3Rpcs {
let mut had_first_success = false;
loop {
match timeout(double_block_time, block_receiver.recv()).await {
match timeout(double_block_time, block_and_rpc_receiver.recv()).await {
Ok(Some((new_block, rpc))) => {
let rpc_name = rpc.name.clone();
let rpc_is_backup = rpc.backup;

View File

@ -83,7 +83,7 @@ impl Web3Rpcs {
Web3ProxyJoinHandle<()>,
watch::Receiver<Option<Arc<RankedRpcs>>>,
)> {
let (block_sender, block_receiver) = mpsc::unbounded_channel::<BlockAndRpc>();
let (block_and_rpc_sender, block_and_rpc_receiver) = mpsc::unbounded_channel::<BlockAndRpc>();
// these blocks don't have full transactions, but they do have rather variable amounts of transaction hashes
// TODO: actual weighter on this
@ -113,7 +113,7 @@ impl Web3Rpcs {
average_block_interval(chain_id).mul_f32((max_head_block_lag.as_u64() * 10) as f32);
let connections = Arc::new(Self {
block_sender,
block_sender: block_and_rpc_sender,
blocks_by_hash,
blocks_by_number,
by_name,
@ -130,7 +130,7 @@ impl Web3Rpcs {
let handle = {
let connections = connections.clone();
tokio::spawn(connections.subscribe(block_receiver))
tokio::spawn(connections.subscribe(block_and_rpc_receiver))
};
Ok((connections, handle, consensus_connections_watcher))
@ -313,7 +313,7 @@ impl Web3Rpcs {
/// transaction ids from all the `Web3Rpc`s are deduplicated and forwarded to `pending_tx_sender`
async fn subscribe(
self: Arc<Self>,
block_receiver: mpsc::UnboundedReceiver<BlockAndRpc>,
block_and_rpc_receiver: mpsc::UnboundedReceiver<BlockAndRpc>,
) -> Web3ProxyResult<()> {
let mut futures = vec![];
@ -348,7 +348,7 @@ impl Web3Rpcs {
let handle = tokio::task::Builder::default()
.name("process_incoming_blocks")
.spawn(async move { connections.process_incoming_blocks(block_receiver).await })?;
.spawn(async move { connections.process_incoming_blocks(block_and_rpc_receiver).await })?;
futures.push(flatten_handle(handle));
}