diff --git a/blockchain/client.go b/blockchain/client.go index 7e67757..440b712 100644 --- a/blockchain/client.go +++ b/blockchain/client.go @@ -93,7 +93,7 @@ func (c *Client) ListenEvents( <-ctx.Done() - return nil + return ctx.Err() }) // Query historical headers. @@ -126,7 +126,7 @@ func (c *Client) ListenEvents( select { case <-ctx.Done(): - return nil + return ctx.Err() case histHeadersC <- firstLiveHeader: } @@ -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 @@ -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)