diff --git a/block/production_test.go b/block/production_test.go index 9f3cc6d73..34744d7e4 100644 --- a/block/production_test.go +++ b/block/production_test.go @@ -61,8 +61,8 @@ func TestCreateEmptyBlocksEnableDisable(t *testing.T) { go manager.ProduceBlockLoop(mCtx) go managerWithEmptyBlocks.ProduceBlockLoop(mCtx) - buf1 := make(chan bool, 100) //dummy to avoid unhealthy event - buf2 := make(chan bool, 100) //dummy to avoid unhealthy event + buf1 := make(chan struct{}, 100) //dummy to avoid unhealthy event + buf2 := make(chan struct{}, 100) //dummy to avoid unhealthy event go manager.AccumulatedDataLoop(mCtx, buf1) go managerWithEmptyBlocks.AccumulatedDataLoop(mCtx, buf2) <-mCtx.Done() @@ -247,7 +247,7 @@ func TestStopBlockProduction(t *testing.T) { wg.Done() // Decrease counter when this goroutine finishes }() - toSubmit := make(chan bool) + toSubmit := make(chan struct{}) go func() { manager.AccumulatedDataLoop(ctx, toSubmit) wg.Done() // Decrease counter when this goroutine finishes diff --git a/block/submit.go b/block/submit.go index 4ab236daf..9b077edaf 100644 --- a/block/submit.go +++ b/block/submit.go @@ -65,7 +65,7 @@ func (m *Manager) SubmitLoop(ctx context.Context) { } // AccumulatedDataLoop is the main loop for accumulating the produced data size. -// It is triggered by the ProducedSizeCh channel, which is triggered by the block production loop when a new block is produced. +// It is triggered by the ProducedSizeCh channel, which is populated by the block production loop when a new block is produced. // It accumulates the size of the produced data and triggers the submission of the batch when the accumulated size is greater than the max size. // It also emits a health status event when the submission channel is full. func (m *Manager) AccumulatedDataLoop(ctx context.Context, toSubmit chan struct{}) { diff --git a/block/submit_test.go b/block/submit_test.go index 86c1415d3..b067d49e7 100644 --- a/block/submit_test.go +++ b/block/submit_test.go @@ -48,7 +48,7 @@ func TestBatchSubmissionHappyFlow(t *testing.T) { assert.Zero(t, manager.SyncTarget.Load()) // submit and validate sync target - manager.HandleSubmissionTrigger(ctx) + manager.HandleSubmissionTrigger() assert.EqualValues(t, manager.Store.Height(), manager.SyncTarget.Load()) } @@ -96,11 +96,11 @@ func TestBatchSubmissionFailedSubmission(t *testing.T) { // try to submit, we expect failure mockLayerI.On("SubmitBatch", mock.Anything, mock.Anything, mock.Anything).Return(fmt.Errorf("Failed to submit batch")).Once() - assert.Error(t, manager.HandleSubmissionTrigger(ctx)) + assert.Error(t, manager.HandleSubmissionTrigger()) // try to submit again, we expect success mockLayerI.On("SubmitBatch", mock.Anything, mock.Anything, mock.Anything).Return(nil).Once() - manager.HandleSubmissionTrigger(ctx) + manager.HandleSubmissionTrigger() assert.EqualValues(t, manager.Store.Height(), manager.SyncTarget.Load()) }