rename block_ to block_and_rpc_ where applicable
This commit is contained in:
parent
5b9ef30e64
commit
36eb520f84
@ -334,7 +334,7 @@ impl Web3RpcConfig {
|
|||||||
block_interval: Duration,
|
block_interval: Duration,
|
||||||
http_client: Option<reqwest::Client>,
|
http_client: Option<reqwest::Client>,
|
||||||
blocks_by_hash_cache: BlocksByHashCache,
|
blocks_by_hash_cache: BlocksByHashCache,
|
||||||
block_sender: Option<mpsc::UnboundedSender<BlockAndRpc>>,
|
block_and_rpc_sender: Option<mpsc::UnboundedSender<BlockAndRpc>>,
|
||||||
max_head_block_age: Duration,
|
max_head_block_age: Duration,
|
||||||
) -> anyhow::Result<(Arc<Web3Rpc>, Web3ProxyJoinHandle<()>)> {
|
) -> anyhow::Result<(Arc<Web3Rpc>, Web3ProxyJoinHandle<()>)> {
|
||||||
if !self.extra.is_empty() {
|
if !self.extra.is_empty() {
|
||||||
@ -351,7 +351,7 @@ impl Web3RpcConfig {
|
|||||||
server_id,
|
server_id,
|
||||||
block_interval,
|
block_interval,
|
||||||
blocks_by_hash_cache,
|
blocks_by_hash_cache,
|
||||||
block_sender,
|
block_and_rpc_sender,
|
||||||
max_head_block_age,
|
max_head_block_age,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
@ -408,7 +408,7 @@ impl Web3Rpcs {
|
|||||||
|
|
||||||
pub(super) async fn process_incoming_blocks(
|
pub(super) async fn process_incoming_blocks(
|
||||||
&self,
|
&self,
|
||||||
mut block_receiver: mpsc::UnboundedReceiver<BlockAndRpc>,
|
mut block_and_rpc_receiver: mpsc::UnboundedReceiver<BlockAndRpc>,
|
||||||
) -> Web3ProxyResult<()> {
|
) -> Web3ProxyResult<()> {
|
||||||
let mut consensus_finder =
|
let mut consensus_finder =
|
||||||
ConsensusFinder::new(Some(self.max_head_block_age), Some(self.max_head_block_lag));
|
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;
|
let mut had_first_success = false;
|
||||||
|
|
||||||
loop {
|
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))) => {
|
Ok(Some((new_block, rpc))) => {
|
||||||
let rpc_name = rpc.name.clone();
|
let rpc_name = rpc.name.clone();
|
||||||
let rpc_is_backup = rpc.backup;
|
let rpc_is_backup = rpc.backup;
|
||||||
|
@ -83,7 +83,7 @@ impl Web3Rpcs {
|
|||||||
Web3ProxyJoinHandle<()>,
|
Web3ProxyJoinHandle<()>,
|
||||||
watch::Receiver<Option<Arc<RankedRpcs>>>,
|
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
|
// these blocks don't have full transactions, but they do have rather variable amounts of transaction hashes
|
||||||
// TODO: actual weighter on this
|
// 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);
|
average_block_interval(chain_id).mul_f32((max_head_block_lag.as_u64() * 10) as f32);
|
||||||
|
|
||||||
let connections = Arc::new(Self {
|
let connections = Arc::new(Self {
|
||||||
block_sender,
|
block_sender: block_and_rpc_sender,
|
||||||
blocks_by_hash,
|
blocks_by_hash,
|
||||||
blocks_by_number,
|
blocks_by_number,
|
||||||
by_name,
|
by_name,
|
||||||
@ -130,7 +130,7 @@ impl Web3Rpcs {
|
|||||||
let handle = {
|
let handle = {
|
||||||
let connections = connections.clone();
|
let connections = connections.clone();
|
||||||
|
|
||||||
tokio::spawn(connections.subscribe(block_receiver))
|
tokio::spawn(connections.subscribe(block_and_rpc_receiver))
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok((connections, handle, consensus_connections_watcher))
|
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`
|
/// transaction ids from all the `Web3Rpc`s are deduplicated and forwarded to `pending_tx_sender`
|
||||||
async fn subscribe(
|
async fn subscribe(
|
||||||
self: Arc<Self>,
|
self: Arc<Self>,
|
||||||
block_receiver: mpsc::UnboundedReceiver<BlockAndRpc>,
|
block_and_rpc_receiver: mpsc::UnboundedReceiver<BlockAndRpc>,
|
||||||
) -> Web3ProxyResult<()> {
|
) -> Web3ProxyResult<()> {
|
||||||
let mut futures = vec![];
|
let mut futures = vec![];
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ impl Web3Rpcs {
|
|||||||
|
|
||||||
let handle = tokio::task::Builder::default()
|
let handle = tokio::task::Builder::default()
|
||||||
.name("process_incoming_blocks")
|
.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));
|
futures.push(flatten_handle(handle));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user