From 28ec00500b049c47d432023a9124a7d20a5d9f63 Mon Sep 17 00:00:00 2001 From: Travis Person Date: Thu, 20 Feb 2020 03:06:41 +0000 Subject: [PATCH] chainwatch: reduce memory usage during large chain gaps --- cmd/lotus-chainwatch/sync.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/lotus-chainwatch/sync.go b/cmd/lotus-chainwatch/sync.go index a60afb2b7..9a7743dd5 100644 --- a/cmd/lotus-chainwatch/sync.go +++ b/cmd/lotus-chainwatch/sync.go @@ -67,7 +67,6 @@ type actorInfo struct { func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipSet) { addresses := map[address.Address]address.Address{} - actors := map[address.Address]map[types.Actor]actorInfo{} var alk sync.Mutex log.Infof("Getting synced block list") @@ -114,6 +113,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS } for len(allToSync) > 0 { + actors := map[address.Address]map[types.Actor]actorInfo{} minH := uint64(math.MaxUint64) for _, header := range allToSync { @@ -200,7 +200,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS log.Error(err) return } - ast, err := api.StateReadState(ctx, &act, ts.Key()) + ast, err := api.StateReadState(ctx, &act, pts.Key()) if err != nil { log.Error(err) return