diff --git a/rpc/handlers.go b/rpc/handlers.go index a383ff4bc..73b75af01 100644 --- a/rpc/handlers.go +++ b/rpc/handlers.go @@ -564,7 +564,7 @@ func (h *Handler) MethodsV0_7() ([]jsonrpc.Method, string) { //nolint: funlen { Name: "starknet_subscribeNewHeads", Params: []jsonrpc.Parameter{{Name: "block", Optional: true}}, - Handler: h.SubscribeNewHeadsV0_7, + Handler: h.SubscribeNewHeads, }, { Name: "starknet_unsubscribe", diff --git a/rpc/subscriptions.go b/rpc/subscriptions.go index 39f79cdf2..98a5668ea 100644 --- a/rpc/subscriptions.go +++ b/rpc/subscriptions.go @@ -339,14 +339,6 @@ func sendEvents(ctx context.Context, w jsonrpc.Conn, events []*blockchain.Filter // SubscribeNewHeads creates a WebSocket stream which will fire events when a new block header is added. func (h *Handler) SubscribeNewHeads(ctx context.Context, blockID *BlockID) (*SubscriptionID, *jsonrpc.Error) { - return h.subscribeNewHeads(ctx, blockID, V0_8) -} - -func (h *Handler) SubscribeNewHeadsV0_7(ctx context.Context, blockID *BlockID) (*SubscriptionID, *jsonrpc.Error) { - return h.subscribeNewHeads(ctx, blockID, V0_7) -} - -func (h *Handler) subscribeNewHeads(ctx context.Context, blockID *BlockID, rpcVersion version) (*SubscriptionID, *jsonrpc.Error) { w, ok := jsonrpc.ConnFromContext(ctx) if !ok { return nil, jsonrpc.Err(jsonrpc.MethodNotFound, nil) @@ -383,7 +375,7 @@ func (h *Handler) subscribeNewHeads(ctx context.Context, blockID *BlockID, rpcVe var wg conc.WaitGroup wg.Go(func() { - if err := h.sendHistoricalHeaders(subscriptionCtx, startHeader, latestHeader, w, id, rpcVersion); err != nil { + if err := h.sendHistoricalHeaders(subscriptionCtx, startHeader, latestHeader, w, id); err != nil { h.log.Errorw("Error sending old headers", "err", err) return } @@ -394,7 +386,7 @@ func (h *Handler) subscribeNewHeads(ctx context.Context, blockID *BlockID, rpcVe }) wg.Go(func() { - h.processNewHeaders(subscriptionCtx, headerSub, w, id, rpcVersion) + h.processNewHeaders(subscriptionCtx, headerSub, w, id) }) wg.Wait() @@ -562,7 +554,6 @@ func (h *Handler) sendHistoricalHeaders( startHeader, latestHeader *core.Header, w jsonrpc.Conn, id uint64, - rpcVersion version, ) error { var ( err error @@ -590,7 +581,7 @@ func (h *Handler) sendHistoricalHeaders( } } -func (h *Handler) processNewHeaders(ctx context.Context, headerSub *feed.Subscription[*core.Header], w jsonrpc.Conn, id uint64, rpcVersion version) { +func (h *Handler) processNewHeaders(ctx context.Context, headerSub *feed.Subscription[*core.Header], w jsonrpc.Conn, id uint64) { for { select { case <-ctx.Done():