Skip to content

Commit

Permalink
[FAB-9851] Enable PvtChanData by default in v1.2
Browse files Browse the repository at this point in the history
In v1.1, the private data feature within a channel
is an experimental feature. Hence, one needs to set
privateChannelData capability in config tx to
enable it. In v1.2, private data feature is
enabled by default, i.e., non-experimental.

As a result, privateChannelData() capability API in
v1.2 should return (privateChannelData || v1.2) to
support rolling upgrades. In v1.3, we can remove the
privateChannelData capability flag.

Change-Id: I9f1adbe87b8bab1d98b89602cca410fba18aba86
Signed-off-by: senthil <[email protected]>
  • Loading branch information
cendhu committed May 4, 2018
1 parent 0a34859 commit a3e455f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/capabilities/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ func (ap *ApplicationProvider) ForbidDuplicateTXIdInBlock() bool {
}

// PrivateChannelData returns true if support for private channel data (a.k.a. collections) is enabled.
// In v1.1, the private channel data is experimental and has to be enabled explicitly.
// In v1.2, the private channel data is enabled by default.
func (ap *ApplicationProvider) PrivateChannelData() bool {
return ap.v11PvtDataExperimental
return ap.v11PvtDataExperimental || ap.v12
}

// V1_1Validation returns true is this channel is configured to perform stricter validation
Expand Down
6 changes: 6 additions & 0 deletions common/capabilities/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ func TestApplicationPvtDataExperimental(t *testing.T) {
ApplicationPvtDataExperimental: {},
})
assert.True(t, op.PrivateChannelData())

op = NewApplicationProvider(map[string]*cb.Capability{
ApplicationV1_2: {},
})
assert.True(t, op.PrivateChannelData())

}

func TestChaincodeLifecycleExperimental(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions common/channelconfig/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ type ApplicationCapabilities interface {
ResourcesTree() bool

// PrivateChannelData returns true if support for private channel data (a.k.a. collections) is enabled.
// In v1.1, the private channel data is experimental and has to be enabled explicitly.
// In v1.2, the private channel data is enabled by default.
PrivateChannelData() bool

// V1_1Validation returns true is this channel is configured to perform stricter validation
Expand Down

0 comments on commit a3e455f

Please sign in to comment.