mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +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>,
|
proposer_index: Option<u64>,
|
||||||
builder_boost_factor: Option<u64>,
|
builder_boost_factor: Option<u64>,
|
||||||
) -> Result<UnsignedBlock<S::E>, BlockError> {
|
) -> Result<UnsignedBlock<S::E>, BlockError> {
|
||||||
let (block_response, _) = beacon_node
|
let block_response = match beacon_node
|
||||||
.get_validator_blocks_v3::<S::E>(
|
.get_validator_blocks_v3_ssz::<S::E>(
|
||||||
slot,
|
slot,
|
||||||
randao_reveal_ref,
|
randao_reveal_ref,
|
||||||
graffiti.as_ref(),
|
graffiti.as_ref(),
|
||||||
builder_boost_factor,
|
builder_boost_factor,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
{
|
||||||
BlockError::Recoverable(format!(
|
Ok((ssz_block_response, _)) => ssz_block_response,
|
||||||
"Error from beacon node when producing block: {:?}",
|
Err(e) => {
|
||||||
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) => {
|
eth2::types::ProduceBlockV3Response::Full(block) => {
|
||||||
(block.block().proposer_index(), UnsignedBlock::Full(block))
|
(block.block().proposer_index(), UnsignedBlock::Full(block))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user