Reduce calls to network channel (#4863)

## Issue Addressed

N/A

## Proposed Changes

Sends blocks and blobs from http_api to the network channel for publishing in a single network channel send. This is to avoid overhead of multiple calls.
Also adds a metric for rpc blob retrieval duration.
This commit is contained in:
Pawan Dhananjay
2023-10-20 19:42:47 +00:00
parent e8fba8d3a7
commit 074c4951fc
4 changed files with 82 additions and 13 deletions

View File

@@ -4705,6 +4705,14 @@ fn publish_pubsub_message<T: EthSpec>(
)
}
/// Publish a message to the libp2p pubsub network.
fn publish_pubsub_messages<T: EthSpec>(
network_tx: &UnboundedSender<NetworkMessage<T>>,
messages: Vec<PubsubMessage<T>>,
) -> Result<(), warp::Rejection> {
publish_network_message(network_tx, NetworkMessage::Publish { messages })
}
/// Publish a message to the libp2p network.
fn publish_network_message<T: EthSpec>(
network_tx: &UnboundedSender<NetworkMessage<T>>,