events: allow get on empty ts cache

This commit is contained in:
Łukasz Magiera 2019-12-03 18:41:31 +01:00
parent f43ff07ab3
commit 6127d82c7b

View File

@ -92,7 +92,8 @@ func (tsc *tipSetCache) getNonNull(height uint64) (*types.TipSet, error) {
func (tsc *tipSetCache) get(height uint64) (*types.TipSet, error) { func (tsc *tipSetCache) get(height uint64) (*types.TipSet, error) {
if tsc.len == 0 { if tsc.len == 0 {
return nil, xerrors.New("tipSetCache.get: cache is empty") log.Warnf("tipSetCache.get: cache is empty, requesting from storage (h=%d)", height)
return tsc.storage(context.TODO(), height, nil)
} }
headH := tsc.cache[tsc.start].Height() headH := tsc.cache[tsc.start].Height()