mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Co-authored-by: norwnd <112318969+norwnd@users.noreply.github.com>
This commit is contained in:
parent
0e6d2f4b94
commit
5311a890fa
1 changed files with 8 additions and 1 deletions
|
|
@ -343,7 +343,14 @@ func (ec *Client) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, err
|
|||
// SubscribeNewHead subscribes to notifications about the current blockchain head
|
||||
// on the given channel.
|
||||
func (ec *Client) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) {
|
||||
return ec.c.EthSubscribe(ctx, ch, "newHeads")
|
||||
sub, err := ec.c.EthSubscribe(ctx, ch, "newHeads")
|
||||
if err != nil {
|
||||
// Defensively prefer returning nil interface explicitly on error-path, instead
|
||||
// of letting default golang behavior wrap it with non-nil interface that stores
|
||||
// nil concrete type value.
|
||||
return nil, err
|
||||
}
|
||||
return sub, nil
|
||||
}
|
||||
|
||||
// State Access
|
||||
|
|
|
|||
Loading…
Reference in a new issue