From 836d7e07f9816e6ea5123b108ce2ea3a5644e7b8 Mon Sep 17 00:00:00 2001
From: ledgerwatch <akhounov@gmail.com>
Date: Sat, 18 Sep 2021 22:41:27 +0100
Subject: [PATCH] Recreate bitmap in call traces (#2700)

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
---
 eth/stagedsync/stage_call_traces.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/eth/stagedsync/stage_call_traces.go b/eth/stagedsync/stage_call_traces.go
index aeaf0563c1..4f6299d37e 100644
--- a/eth/stagedsync/stage_call_traces.go
+++ b/eth/stagedsync/stage_call_traces.go
@@ -179,13 +179,13 @@ func promoteCallTraces(logPrefix string, tx kv.RwTx, startBlock, endBlock uint64
 }
 
 func finaliseCallTraces(collectorFrom, collectorTo *etl.Collector, logPrefix string, tx kv.RwTx, quit <-chan struct{}) error {
-	var currentBitmap = roaring64.New()
 	var buf = bytes.NewBuffer(nil)
 	lastChunkKey := make([]byte, 128)
 	reader := bytes.NewReader(nil)
 	reader2 := bytes.NewReader(nil)
 	var loaderFunc = func(k []byte, v []byte, table etl.CurrentTableReader, next etl.LoadNextFunc) error {
 		reader.Reset(v)
+		currentBitmap := roaring64.New()
 		if _, err := currentBitmap.ReadFrom(reader); err != nil {
 			return err
 		}
@@ -215,7 +215,6 @@ func finaliseCallTraces(collectorFrom, collectorTo *etl.Collector, logPrefix str
 		}); err != nil {
 			return err
 		}
-		currentBitmap.Clear()
 		return nil
 	}
 	if err := collectorFrom.Load(logPrefix, tx, kv.CallFromIndex, loaderFunc, etl.TransformArgs{Quit: quit}); err != nil {
-- 
GitLab