From 755252c760c60e6ee7fa8d7e50ef738ebf176752 Mon Sep 17 00:00:00 2001 From: Goran Rojovic Date: Wed, 28 Aug 2024 11:49:43 +0200 Subject: [PATCH] fix: add ctx to reorg detector start function --- cmd/main.go | 2 +- synchronizer/reorg.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index b18bf6cf..409c2fd2 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -127,7 +127,7 @@ func start(cliCtx *cli.Context) error { log.Fatal(err) } - if err = detector.Start(); err != nil { + if err = detector.Start(cliCtx.Context); err != nil { log.Fatal(err) } diff --git a/synchronizer/reorg.go b/synchronizer/reorg.go index 71725b17..af2d79d4 100644 --- a/synchronizer/reorg.go +++ b/synchronizer/reorg.go @@ -41,10 +41,10 @@ func (rd *ReorgDetector) Subscribe() <-chan BlockReorg { } // Start starts the ReorgDetector tracking for reorg events -func (rd *ReorgDetector) Start() error { +func (rd *ReorgDetector) Start(ctx context.Context) error { log.Info("starting block reorganization detector") - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(ctx) rd.cancel = cancel blocks := make(chan *ethgo.Block)