mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 11:20:45 +00:00
eth/fetcher: minor updates
This commit is contained in:
parent
2f3a1628fe
commit
ce581fd394
1 changed files with 6 additions and 3 deletions
|
|
@ -491,6 +491,7 @@ func (f *BlobFetcher) loop() {
|
||||||
|
|
||||||
// Trigger timeout for new schedule
|
// Trigger timeout for new schedule
|
||||||
f.rescheduleTimeout(timeoutTimer, timeoutTrigger)
|
f.rescheduleTimeout(timeoutTimer, timeoutTrigger)
|
||||||
|
|
||||||
case delivery := <-f.cleanup:
|
case delivery := <-f.cleanup:
|
||||||
// Remove from announce
|
// Remove from announce
|
||||||
var requestId int
|
var requestId int
|
||||||
|
|
@ -604,6 +605,7 @@ func (f *BlobFetcher) loop() {
|
||||||
}
|
}
|
||||||
// Something was delivered, try to reschedule requests
|
// Something was delivered, try to reschedule requests
|
||||||
f.scheduleFetches(timeoutTimer, timeoutTrigger, nil) // Partial delivery may enable others to deliver too
|
f.scheduleFetches(timeoutTimer, timeoutTrigger, nil) // Partial delivery may enable others to deliver too
|
||||||
|
|
||||||
case drop := <-f.drop:
|
case drop := <-f.drop:
|
||||||
// A peer was dropped, remove all traces of it
|
// A peer was dropped, remove all traces of it
|
||||||
delete(f.peerTokens, drop.peer)
|
delete(f.peerTokens, drop.peer)
|
||||||
|
|
@ -763,9 +765,11 @@ func (f *BlobFetcher) recoverable(hash common.Hash) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, ok := f.full[hash]; ok {
|
if _, ok := f.full[hash]; ok {
|
||||||
|
// Full case: peer coverage is enough to recover the blob
|
||||||
return covered.OneCount() >= kzg4844.DataPerBlob
|
return covered.OneCount() >= kzg4844.DataPerBlob
|
||||||
}
|
}
|
||||||
// return false if our custody cannot be covered
|
// Partial case:
|
||||||
|
// return true if our custody can be covered
|
||||||
return f.custody.Difference(covered).OneCount() == 0
|
return f.custody.Difference(covered).OneCount() == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -879,8 +883,7 @@ func (f *BlobFetcher) scheduleFetches(timer *mclock.Timer, timeout chan struct{}
|
||||||
f.requests[peer] = request
|
f.requests[peer] = request
|
||||||
// Iterate over a copy: the loop may swap-truncate f.requests[peer]
|
// Iterate over a copy: the loop may swap-truncate f.requests[peer]
|
||||||
// concurrently when a delivery for this peer arrives.
|
// concurrently when a delivery for this peer arrives.
|
||||||
reqs := make([]*cellRequest, len(request))
|
reqs := slices.Clone(request)
|
||||||
copy(reqs, request)
|
|
||||||
go func() {
|
go func() {
|
||||||
for _, req := range reqs {
|
for _, req := range reqs {
|
||||||
blobRequestOutMeter.Mark(int64(len(req.txs)))
|
blobRequestOutMeter.Mark(int64(len(req.txs)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue