fixup! Improve error handling

This commit is contained in:
Emilia Hane 2023-01-21 14:46:24 +01:00
parent f7eb89ddd9
commit 5fc648217d
No known key found for this signature in database
GPG Key ID: E73394F9C09206FA

View File

@ -250,23 +250,37 @@ impl<T: BeaconChainTypes> Worker<T> {
let finalized_data_availability_boundary = self.chain.finalized_data_availability_boundary(); let finalized_data_availability_boundary = self.chain.finalized_data_availability_boundary();
let block_epoch = block.epoch(); let block_epoch = block.epoch();
if Some(block_epoch) >= finalized_data_availability_boundary { match finalized_data_availability_boundary {
error!( Some(boundary_epoch) => {
self.log, if block_epoch >= finalized_data_availability_boundary {
"Peer requested block and blob that should be available, but no blob found"; error!(
"peer" => %peer_id, self.log,
"request_root" => ?root, "Peer requested block and blob that should be available, but no blob found";
"finalized_data_availability_boundary" => finalized_data_availability_boundary, "peer" => %peer_id,
); "request_root" => ?root,
} else { "finalized_data_availability_boundary" => finalized_data_availability_boundary,
debug!( );
self.log, } else {
"Peer requested block and blob older than the data availability \ debug!(
boundary for ByRoot request, no blob found"; self.log,
"peer" => %peer_id, "Peer requested block and blob older than the data availability \
"request_root" => ?root, boundary for ByRoot request, no blob found";
"finalized_data_availability_boundary" => finalized_data_availability_boundary, "peer" => %peer_id,
); "request_root" => ?root,
"finalized_data_availability_boundary" => finalized_data_availability_boundary,
);
}
}
None => {
debug!(self.log, "Eip4844 fork is disabled");
self.send_error_response(
peer_id,
RPCResponseErrorCode::ResourceUnavailable,
"Eip4844 fork is disabled".into(),
request_id,
);
return;
}
} }
} }
Ok((None, Some(_))) => { Ok((None, Some(_))) => {