mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-31 16:21:21 +00:00
no panic on nil filters (#2751)
This commit is contained in:
parent
31d04ad88b
commit
0ec73d6390
@ -39,6 +39,9 @@ func (api *APIImpl) GetFilterChanges(_ context.Context, index hexutil.Uint64) ([
|
|||||||
|
|
||||||
// NewHeads send a notification each time a new (header) block is appended to the chain.
|
// NewHeads send a notification each time a new (header) block is appended to the chain.
|
||||||
func (api *APIImpl) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
|
func (api *APIImpl) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
|
||||||
|
if api.filters == nil {
|
||||||
|
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
|
||||||
|
}
|
||||||
notifier, supported := rpc.NotifierFromContext(ctx)
|
notifier, supported := rpc.NotifierFromContext(ctx)
|
||||||
if !supported {
|
if !supported {
|
||||||
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
|
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
|
||||||
@ -71,6 +74,9 @@ func (api *APIImpl) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
|
|||||||
|
|
||||||
// NewPendingTransactions send a notification each time a new (header) block is appended to the chain.
|
// NewPendingTransactions send a notification each time a new (header) block is appended to the chain.
|
||||||
func (api *APIImpl) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error) {
|
func (api *APIImpl) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error) {
|
||||||
|
if api.filters == nil {
|
||||||
|
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
|
||||||
|
}
|
||||||
notifier, supported := rpc.NotifierFromContext(ctx)
|
notifier, supported := rpc.NotifierFromContext(ctx)
|
||||||
if !supported {
|
if !supported {
|
||||||
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
|
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
|
||||||
|
Loading…
Reference in New Issue
Block a user