mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/storage/feed/lookup: more comments
This commit is contained in:
parent
2096c44071
commit
709cc6f3ea
1 changed files with 8 additions and 3 deletions
|
|
@ -100,7 +100,7 @@ func LongEarthAlgorithm(ctx context.Context, now uint64, hint Epoch, read ReadFu
|
|||
lookAhead()
|
||||
case <-ctxR.Done():
|
||||
if valueR != nil {
|
||||
lookAhead()
|
||||
lookAhead() // only look ahead if R was successful
|
||||
}
|
||||
case <-ctxA.Done():
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ func LongEarthAlgorithm(ctx context.Context, now uint64, hint Epoch, read ReadFu
|
|||
lookBack()
|
||||
case <-ctxR.Done():
|
||||
if valueR == nil {
|
||||
lookBack()
|
||||
lookBack() // only look back in case R failed
|
||||
}
|
||||
case <-ctxB.Done():
|
||||
}
|
||||
|
|
@ -162,13 +162,18 @@ func LongEarthAlgorithm(ctx context.Context, now uint64, hint Epoch, read ReadFu
|
|||
return value, nil
|
||||
}
|
||||
|
||||
// at this point the algorithm did not return a value,
|
||||
// so we challenge the hint given.
|
||||
value, err := read(ctx, hint, now)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if value != nil {
|
||||
return value, nil
|
||||
return value, nil // hint is valid, return it.
|
||||
}
|
||||
|
||||
// hint is invalid. Invoke the algorithm
|
||||
// without hint.
|
||||
now = hint.Base()
|
||||
if hint.Level == HighestLevel {
|
||||
now--
|
||||
|
|
|
|||
Loading…
Reference in a new issue