mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Use SSZ by default when calling /eth/v3/validator/blocks (#7727)
* #7698
This commit is contained in:
@@ -524,22 +524,44 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> BlockService<S, T> {
|
||||
proposer_index: Option<u64>,
|
||||
builder_boost_factor: Option<u64>,
|
||||
) -> Result<UnsignedBlock<S::E>, BlockError> {
|
||||
let (block_response, _) = beacon_node
|
||||
.get_validator_blocks_v3::<S::E>(
|
||||
let block_response = match beacon_node
|
||||
.get_validator_blocks_v3_ssz::<S::E>(
|
||||
slot,
|
||||
randao_reveal_ref,
|
||||
graffiti.as_ref(),
|
||||
builder_boost_factor,
|
||||
)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
BlockError::Recoverable(format!(
|
||||
"Error from beacon node when producing block: {:?}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
{
|
||||
Ok((ssz_block_response, _)) => ssz_block_response,
|
||||
Err(e) => {
|
||||
warn!(
|
||||
slot = slot.as_u64(),
|
||||
error = %e,
|
||||
"Beacon node does not support SSZ in block production, falling back to JSON"
|
||||
);
|
||||
|
||||
let (block_proposer, unsigned_block) = match block_response.data {
|
||||
let (json_block_response, _) = beacon_node
|
||||
.get_validator_blocks_v3::<S::E>(
|
||||
slot,
|
||||
randao_reveal_ref,
|
||||
graffiti.as_ref(),
|
||||
builder_boost_factor,
|
||||
)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
BlockError::Recoverable(format!(
|
||||
"Error from beacon node when producing block: {:?}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
|
||||
// Extract ProduceBlockV3Response (data field of the struct ForkVersionedResponse)
|
||||
json_block_response.data
|
||||
}
|
||||
};
|
||||
|
||||
let (block_proposer, unsigned_block) = match block_response {
|
||||
eth2::types::ProduceBlockV3Response::Full(block) => {
|
||||
(block.block().proposer_index(), UnsignedBlock::Full(block))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user