From 76a7c8bd2abd324d898f4d98e8e1eb67f39c3269 Mon Sep 17 00:00:00 2001 From: GiangTran Date: Mon, 8 Jan 2024 11:53:47 +0700 Subject: [PATCH] fix test --- pkg/listener/evm_client_mock_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/listener/evm_client_mock_test.go b/pkg/listener/evm_client_mock_test.go index 15462ad..aa2030d 100644 --- a/pkg/listener/evm_client_mock_test.go +++ b/pkg/listener/evm_client_mock_test.go @@ -71,11 +71,11 @@ func (c *EVMClientMock) Next() { defer c.mu.Unlock() c.head++ - + currentHead := c.head // Publish new head for subscriptions. for _, ch := range c.subHeadChs { go func(ch chan<- *types.Header) { - header := c.headerMap[c.sequence[c.head]] + header := c.headerMap[c.sequence[currentHead]] ch <- &types.Header{ Hash: common.ToHex(header.Hash()), ParentHash: common.ToHex(header.ParentHash), @@ -108,10 +108,10 @@ func (c *EVMClientMock) SubscribeNewHead(ctx context.Context, ch chan<- *types.H defer c.mu.Unlock() c.subHeadChs = append(c.subHeadChs, ch) - + currentHead := c.sequence[c.head] // Publish current head to the channel. go func() { - header := c.headerMap[c.sequence[c.head]] + header := c.headerMap[currentHead] ch <- &types.Header{ Hash: common.ToHex(header.Hash()), ParentHash: common.ToHex(header.ParentHash),