only request blobs if a sync response actually provided blocks (#6121)
During sync, we can skip the `blobSidecarsByRange` request when there are no blocks with `kzg_commitments` in the blocks data. Avoids running into throttling from peers during long periods of non-finality.
This commit is contained in:
parent
17ee40b39b
commit
9d5643240b
|
@ -409,6 +409,19 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A)
|
|||
request = req
|
||||
return
|
||||
|
||||
let shouldGetBlobs =
|
||||
if not man.shouldGetBlobs(req.slot.epoch):
|
||||
false
|
||||
else:
|
||||
var hasBlobs = false
|
||||
for blck in blockData:
|
||||
withBlck(blck[]):
|
||||
when consensusFork >= ConsensusFork.Deneb:
|
||||
if forkyBlck.message.body.blob_kzg_commitments.len > 0:
|
||||
hasBlobs = true
|
||||
break
|
||||
hasBlobs
|
||||
|
||||
func combine(acc: seq[Slot], cur: Slot): seq[Slot] =
|
||||
var copy = acc
|
||||
if copy[copy.len-1] != cur:
|
||||
|
@ -416,7 +429,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A)
|
|||
copy
|
||||
|
||||
let blobData =
|
||||
if man.shouldGetBlobs(req.slot.epoch):
|
||||
if shouldGetBlobs:
|
||||
let blobs = await man.getBlobSidecars(peer, req)
|
||||
if blobs.isErr():
|
||||
peer.updateScore(PeerScoreNoValues)
|
||||
|
|
Loading…
Reference in New Issue