tscache: fix storage fetch
This commit is contained in:
parent
9fe0c3ec68
commit
d7562d8716
@ -71,11 +71,11 @@ func (tsc *tipSetCache) get(height uint64) (*types.TipSet, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clen := len(tsc.cache)
|
clen := len(tsc.cache)
|
||||||
tailH := tsc.cache[normalModulo(tsc.start-tsc.len+1, clen)].Height()
|
tail := tsc.cache[normalModulo(tsc.start-tsc.len+1, clen)]
|
||||||
|
|
||||||
if height < tailH {
|
if height < tail.Height() {
|
||||||
log.Warnf("tipSetCache.get: requested tipset not in cache, requesting from storage (h=%d; tail=%d)", height, tailH)
|
log.Warnf("tipSetCache.get: requested tipset not in cache, requesting from storage (h=%d; tail=%d)", height, tail.Height())
|
||||||
return tsc.storage(context.TODO(), height, tsc.cache[tailH])
|
return tsc.storage(context.TODO(), height, tail)
|
||||||
}
|
}
|
||||||
|
|
||||||
return tsc.cache[normalModulo(tsc.start-int(headH-height), clen)], nil
|
return tsc.cache[normalModulo(tsc.start-int(headH-height), clen)], nil
|
||||||
|
Loading…
Reference in New Issue
Block a user