diff --git a/multinode/adaptor.go b/multinode/adaptor.go index 86d2ba3..3898460 100644 --- a/multinode/adaptor.go +++ b/multinode/adaptor.go @@ -58,11 +58,11 @@ func (m *Adapter[RPC, HEAD]) LenSubs() int { } // RegisterSub adds the sub to the Adaptor list and returns a sub which is managed on unsubscribe -func (m *Adapter[RPC, HEAD]) RegisterSub(sub Subscription, stopInFLightCh chan struct{}) (*ManagedSubscription, error) { +func (m *Adapter[RPC, HEAD]) RegisterSub(sub Subscription) (*ManagedSubscription, error) { // ensure that the `sub` belongs to current life cycle of the `rpcMultiNodeAdapter` and it should not be killed due to // previous `DisconnectAll` call. select { - case <-stopInFLightCh: + case <-m.chStopInFlight: sub.Unsubscribe() return nil, fmt.Errorf("failed to register subscription - all in-flight requests were canceled") default: diff --git a/multinode/adaptor_test.go b/multinode/adaptor_test.go index 70eb104..36a1c5c 100644 --- a/multinode/adaptor_test.go +++ b/multinode/adaptor_test.go @@ -29,10 +29,6 @@ func LatestBlock(ctx context.Context, rpc *testRPC) (*testHead, error) { return &testHead{rpc.latestBlock}, nil } -func ptr[T any](t T) *T { - return &t -} - func newTestClient(t *testing.T) *Adapter[testRPC, *testHead] { requestTimeout := 5 * time.Second lggr := logger.Test(t)