Skip to content

Commit

Permalink
Return ctx.Err()
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoloch committed Oct 15, 2024
1 parent 4bbb78f commit 21a360d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blockchain/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (c *Client) ListenEvents(

<-ctx.Done()

return nil
return ctx.Err()
})

// Query historical headers.
Expand Down Expand Up @@ -126,7 +126,7 @@ func (c *Client) ListenEvents(

select {
case <-ctx.Done():
return nil
return ctx.Err()
case histHeadersC <- firstLiveHeader:
}

Expand All @@ -153,7 +153,7 @@ func (c *Client) ListenEvents(
for {
select {
case <-ctx.Done():
return nil
return ctx.Err()
case header := <-headersC:
if header.Number < begin {
continue
Expand Down Expand Up @@ -187,7 +187,7 @@ func (c *Client) ListenEvents(
for {
select {
case <-ctx.Done():
return nil
return ctx.Err()
case blockEvents := <-eventsC:
for callback := range c.eventsListeners {
err := (*callback)(blockEvents.Events, blockEvents.Number, blockEvents.Hash)
Expand Down

0 comments on commit 21a360d

Please sign in to comment.