diff --git a/pkg/context/api/fab/context.go b/pkg/context/api/fab/context.go index d597f1057a..21f23e83ac 100644 --- a/pkg/context/api/fab/context.go +++ b/pkg/context/api/fab/context.go @@ -12,7 +12,6 @@ import "github.com/hyperledger/fabric-sdk-go/pkg/context" type ChannelService interface { Config() (ChannelConfig, error) Ledger() (ChannelLedger, error) - Channel() (Channel, error) // TODO remove Transactor() (Transactor, error) EventHub() (EventHub, error) // TODO support new event delivery Membership() (ChannelMembership, error) diff --git a/pkg/fabsdk/api/pvdr.go b/pkg/fabsdk/api/pvdr.go index a0e26cdebb..3d61c558d2 100644 --- a/pkg/fabsdk/api/pvdr.go +++ b/pkg/fabsdk/api/pvdr.go @@ -16,7 +16,6 @@ import ( // FabricProvider enables access to fabric objects such as peer and user based on config or type FabricProvider interface { - CreateChannelClient(user context.IdentityContext, cfg fab.ChannelCfg) (fab.Channel, error) CreateChannelLedger(ic context.IdentityContext, name string) (fab.ChannelLedger, error) CreateChannelConfig(user context.IdentityContext, name string) (fab.ChannelConfig, error) CreateResourceClient(user context.IdentityContext) (api.Resource, error) diff --git a/pkg/fabsdk/provider/chpvdr/chprovider.go b/pkg/fabsdk/provider/chpvdr/chprovider.go index 2dd5d5b3ee..78bf7e967f 100644 --- a/pkg/fabsdk/provider/chpvdr/chprovider.go +++ b/pkg/fabsdk/provider/chpvdr/chprovider.go @@ -79,11 +79,6 @@ type ChannelService struct { cfg fab.ChannelCfg } -// Channel returns the named Channel client. -func (cs *ChannelService) Channel() (fab.Channel, error) { - return cs.fabricProvider.CreateChannelClient(cs.identityContext, cs.cfg) -} - // EventHub returns the EventHub for the named channel. func (cs *ChannelService) EventHub() (fab.EventHub, error) { return cs.fabricProvider.CreateEventHub(cs.identityContext, cs.cfg.Name()) diff --git a/pkg/fabsdk/provider/chpvdr/chprovider_test.go b/pkg/fabsdk/provider/chpvdr/chprovider_test.go index 6a51760545..abb4ac08a7 100644 --- a/pkg/fabsdk/provider/chpvdr/chprovider_test.go +++ b/pkg/fabsdk/provider/chpvdr/chprovider_test.go @@ -42,22 +42,12 @@ func TestBasicValidChannel(t *testing.T) { t.Fatalf("Unexpected error creating Channel Service: %v", err) } - _, err = channelService.Channel() - if err != nil { - t.Fatalf("Unexpected error creating Channel Service: %v", err) - } - // System channel channelService, err = cp.ChannelService(user, "") if err != nil { t.Fatalf("Unexpected error creating Channel Service: %v", err) } - _, err = channelService.Channel() - if err != nil { - t.Fatalf("Unexpected error creating Channel Service: %v", err) - } - m, err := channelService.Membership() assert.Nil(t, err) assert.NotNil(t, m) diff --git a/pkg/fabsdk/provider/fabpvdr/fabpvdr.go b/pkg/fabsdk/provider/fabpvdr/fabpvdr.go index c525fde1e8..a393ee41d1 100644 --- a/pkg/fabsdk/provider/fabpvdr/fabpvdr.go +++ b/pkg/fabsdk/provider/fabpvdr/fabpvdr.go @@ -53,20 +53,6 @@ func (f *FabricProvider) CreateResourceClient(ic context.IdentityContext) (api.R return client, nil } -// CreateChannelClient returns a new client initialized for the current instance of the SDK. -func (f *FabricProvider) CreateChannelClient(ic context.IdentityContext, cfg fab.ChannelCfg) (fab.Channel, error) { - ctx := &fabContext{ - ProviderContext: f.providerContext, - IdentityContext: ic, - } - channel, err := channelImpl.New(ctx, cfg) - if err != nil { - return nil, errors.WithMessage(err, "NewChannel failed") - } - - return channel, nil -} - // CreateChannelLedger returns a new client initialized for the current instance of the SDK. func (f *FabricProvider) CreateChannelLedger(ic context.IdentityContext, channelName string) (fab.ChannelLedger, error) { ctx := &fabContext{ diff --git a/pkg/fabsdk/provider/fabpvdr/fabpvdr_test.go b/pkg/fabsdk/provider/fabpvdr/fabpvdr_test.go index fc448c19df..563dbac434 100644 --- a/pkg/fabsdk/provider/fabpvdr/fabpvdr_test.go +++ b/pkg/fabsdk/provider/fabpvdr/fabpvdr_test.go @@ -14,7 +14,6 @@ import ( "github.com/hyperledger/fabric-sdk-go/pkg/context/api/fab" "github.com/hyperledger/fabric-sdk-go/pkg/core/config" "github.com/hyperledger/fabric-sdk-go/pkg/core/cryptosuite/bccsp/sw" - channelImpl "github.com/hyperledger/fabric-sdk-go/pkg/fab/channel" identityImpl "github.com/hyperledger/fabric-sdk-go/pkg/fab/identity" "github.com/hyperledger/fabric-sdk-go/pkg/fab/identitymgr" "github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks" @@ -27,21 +26,6 @@ func TestCreateFabricProvider(t *testing.T) { newMockFabricProvider(t) } -func TestCreateChannelClient(t *testing.T) { - p := newMockFabricProvider(t) - - user := mocks.NewMockUser("user") - client, err := p.CreateChannelClient(user, mocks.NewMockChannelCfg("mychannel")) - if err != nil { - t.Fatalf("Unexpected error creating client %v", err) - } - - _, ok := client.(*channelImpl.Channel) - if !ok { - t.Fatalf("Unexpected client impl created: %v", client) - } -} - func TestCreateResourceClient(t *testing.T) { p := newMockFabricProvider(t)