mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Reduce size of futures in HTTP API to prevent stack overflows (#5104)
* Box::pin a few big futures * Arc the blocks early in publication * Fix more tests
This commit is contained in:
@@ -1410,7 +1410,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.and(network_tx_filter.clone())
|
||||
.and(log_filter.clone())
|
||||
.then(
|
||||
move |block_contents: SignedBlindedBeaconBlock<T::EthSpec>,
|
||||
move |block_contents: Arc<SignedBlindedBeaconBlock<T::EthSpec>>,
|
||||
task_spawner: TaskSpawner<T::EthSpec>,
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
network_tx: UnboundedSender<NetworkMessage<T::EthSpec>>,
|
||||
@@ -1450,6 +1450,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
&block_bytes,
|
||||
&chain.spec,
|
||||
)
|
||||
.map(Arc::new)
|
||||
.map_err(|e| {
|
||||
warp_utils::reject::custom_bad_request(format!("invalid SSZ: {e:?}"))
|
||||
})?;
|
||||
@@ -1478,7 +1479,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.and(log_filter.clone())
|
||||
.then(
|
||||
move |validation_level: api_types::BroadcastValidationQuery,
|
||||
blinded_block: SignedBlindedBeaconBlock<T::EthSpec>,
|
||||
blinded_block: Arc<SignedBlindedBeaconBlock<T::EthSpec>>,
|
||||
task_spawner: TaskSpawner<T::EthSpec>,
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
network_tx: UnboundedSender<NetworkMessage<T::EthSpec>>,
|
||||
@@ -1519,6 +1520,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
&block_bytes,
|
||||
&chain.spec,
|
||||
)
|
||||
.map(Arc::new)
|
||||
.map_err(|e| {
|
||||
warp_utils::reject::custom_bad_request(format!("invalid SSZ: {e:?}"))
|
||||
})?;
|
||||
|
||||
Reference in New Issue
Block a user