Fix bug of early termination of batch send
This commit is contained in:
parent
caad492d48
commit
74bca46fc2
@ -972,7 +972,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
}
|
}
|
||||||
Ok((
|
Ok((
|
||||||
self.get_block(block_root).await?.map(Arc::new),
|
self.get_block(block_root).await?.map(Arc::new),
|
||||||
self.get_blobs(block_root).await?.map(Arc::new),
|
self.get_blobs(block_root).ok().flatten().map(Arc::new),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1048,7 +1048,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
/// ## Errors
|
/// ## Errors
|
||||||
///
|
///
|
||||||
/// May return a database error.
|
/// May return a database error.
|
||||||
pub async fn get_blobs(
|
pub fn get_blobs(
|
||||||
&self,
|
&self,
|
||||||
block_root: &Hash256,
|
block_root: &Hash256,
|
||||||
) -> Result<Option<BlobsSidecar<T::EthSpec>>, Error> {
|
) -> Result<Option<BlobsSidecar<T::EthSpec>>, Error> {
|
||||||
@ -1060,7 +1060,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
|
|
||||||
if expected_kzg_commitments.len() > 0 {
|
if expected_kzg_commitments.len() > 0 {
|
||||||
Err(Error::DBInconsistent(format!(
|
Err(Error::DBInconsistent(format!(
|
||||||
"expected kzg_commitments but no blobs stored for block_root {}",
|
"Expected kzg commitments but no blobs stored for block root {}",
|
||||||
block_root
|
block_root
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
|
@ -658,25 +658,22 @@ impl<T: BeaconChainTypes> Worker<T> {
|
|||||||
let send_response = true;
|
let send_response = true;
|
||||||
|
|
||||||
for root in block_roots {
|
for root in block_roots {
|
||||||
match self.chain.store.get_blobs(&root) {
|
match self.chain.get_blobs(&root) {
|
||||||
Ok(Some(blob)) => {
|
Ok(Some(blobs)) => {
|
||||||
let response_data = if blob.blobs.len() > 0 {
|
if blobs.blobs.len() > 0 {
|
||||||
Some(Arc::new(blob))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
blobs_sent += 1;
|
blobs_sent += 1;
|
||||||
self.send_network_message(NetworkMessage::SendResponse {
|
self.send_network_message(NetworkMessage::SendResponse {
|
||||||
peer_id,
|
peer_id,
|
||||||
response: Response::BlobsByRange(response_data),
|
response: Response::BlobsByRange(Some(Arc::new(blobs))),
|
||||||
id: request_id,
|
id: request_id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
error!(
|
error!(
|
||||||
self.log,
|
self.log,
|
||||||
"Blob in the chain is not in the store";
|
"No blobs or block in the store for block root";
|
||||||
"request_root" => ?root
|
"block_root" => ?root
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user