diff --git a/process/dataPool.go b/process/dataPool.go index 57dd4a8..c61c703 100644 --- a/process/dataPool.go +++ b/process/dataPool.go @@ -239,9 +239,19 @@ func (bp *dataPool) getCheckpointData(checkpointKey string) (*data.BlockCheckpoi return checkpoint, nil } +func deepCopyMap(originalMap map[uint32]uint64) map[uint32]uint64 { + newMap := make(map[uint32]uint64) + + for key, value := range originalMap { + newMap[key] = value + } + + return newMap +} + func (bp *dataPool) saveLastSoftCheckpoint() error { bp.mutMap.RLock() - softCheckpointMap := bp.softCheckpointMap + softCheckpointMap := deepCopyMap(bp.softCheckpointMap) bp.mutMap.RUnlock() softCheckpoint := &data.BlockCheckpoint{} diff --git a/process/publisherHandler.go b/process/publisherHandler.go index 9a74d5d..d5fe0b6 100644 --- a/process/publisherHandler.go +++ b/process/publisherHandler.go @@ -156,7 +156,7 @@ func (ph *publisherHandler) updatePublishCheckpoint() { func (ph *publisherHandler) handleLastCheckpointOnInit() error { if ph.resetCheckpoints { - log.Debug("did not checked last publisher checkpoint on init") + log.Debug("did not check last publisher checkpoint on init") return nil }