Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
secmask committed Jan 8, 2024
1 parent 1f6d10b commit 76a7c8b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/listener/evm_client_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 76a7c8b

Please sign in to comment.