mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
fix rate limits, and a couple other bugs
This commit is contained in:
@@ -435,7 +435,7 @@ impl<T: BeaconChainTypes> Worker<T> {
|
||||
// Pick out the required blocks, ignoring skip-slots.
|
||||
let mut last_block_root = req
|
||||
.start_slot
|
||||
.checked_sub(0)
|
||||
.checked_sub(1)
|
||||
.map(|prev_slot| {
|
||||
self.chain
|
||||
.block_root_at_slot(Slot::new(prev_slot), WhenSlotSkipped::Prev)
|
||||
@@ -614,7 +614,7 @@ impl<T: BeaconChainTypes> Worker<T> {
|
||||
// Pick out the required blocks, ignoring skip-slots.
|
||||
let mut last_block_root = req
|
||||
.start_slot
|
||||
.checked_sub(0)
|
||||
.checked_sub(1)
|
||||
.map(|prev_slot| {
|
||||
self.chain
|
||||
.block_root_at_slot(Slot::new(prev_slot), WhenSlotSkipped::Prev)
|
||||
|
||||
@@ -314,14 +314,18 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
let (chain_id, batch_id, info) = entry.get_mut();
|
||||
let chain_id = chain_id.clone();
|
||||
let batch_id = batch_id.clone();
|
||||
let stream_terminator = maybe_block.is_none();
|
||||
info.add_block_response(maybe_block);
|
||||
let maybe_block = info.pop_response().map(|block_sidecar_pair| {
|
||||
let maybe_block_wrapped = info.pop_response().map(|block_sidecar_pair| {
|
||||
BlockWrapper::BlockAndBlob { block_sidecar_pair }
|
||||
});
|
||||
if info.is_finished() {
|
||||
entry.remove();
|
||||
}
|
||||
Some((chain_id, batch_id, maybe_block))
|
||||
if !stream_terminator && maybe_block_wrapped.is_none() {
|
||||
return None
|
||||
}
|
||||
Some((chain_id, batch_id, maybe_block_wrapped))
|
||||
}
|
||||
Entry::Vacant(_) => None,
|
||||
}
|
||||
@@ -356,6 +360,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
let (chain_id, batch_id, info) = entry.get_mut();
|
||||
let chain_id = chain_id.clone();
|
||||
let batch_id = batch_id.clone();
|
||||
let stream_terminator = maybe_sidecar.is_none();
|
||||
info.add_sidecar_response(maybe_sidecar);
|
||||
let maybe_block = info
|
||||
.pop_response()
|
||||
@@ -363,6 +368,9 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
if info.is_finished() {
|
||||
entry.remove();
|
||||
}
|
||||
if !stream_terminator && maybe_block.is_none() {
|
||||
return None
|
||||
}
|
||||
Some((chain_id, batch_id, maybe_block))
|
||||
}
|
||||
Entry::Vacant(_) => None,
|
||||
|
||||
Reference in New Issue
Block a user