Skip to content

Commit

Permalink
[FAB-5687] Stub out configtxgen rscc_seed_data
Browse files Browse the repository at this point in the history
There needs to be some initial values for the rscc_seed_data as output
by configtxgen.  This CR simply stubs in some example values (to be
updated with the real values later) as an example for how this can be
accomplished.

Change-Id: Ia7be67601874cd0137a41070bf4b748652742155
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Aug 12, 2017
1 parent 91155fb commit 9a4172e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions common/config/channel/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ package config
import (
"fmt"

"github.com/hyperledger/fabric/common/cauthdsl"
configmsp "github.com/hyperledger/fabric/common/config/channel/msp"
"github.com/hyperledger/fabric/common/configtx"
"github.com/hyperledger/fabric/common/policies"
"github.com/hyperledger/fabric/common/util"
"github.com/hyperledger/fabric/msp"
cb "github.com/hyperledger/fabric/protos/common"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/hyperledger/fabric/protos/utils"
)

Expand Down Expand Up @@ -63,6 +65,38 @@ func (cct *channelCreationTemplate) Envelope(channelID string) (*cb.ConfigUpdate
ChannelId: channelID,
ReadSet: rSet,
WriteSet: wSet,
IsolatedData: map[string][]byte{
pb.RSCCSeedDataKey: utils.MarshalOrPanic(&cb.Config{
Type: int32(cb.ConfigType_RESOURCE),
ChannelGroup: &cb.ConfigGroup{
// All of the default seed data values would inside this ConfigGroup
Values: map[string]*cb.ConfigValue{
"QSCC.Example1": &cb.ConfigValue{
Value: utils.MarshalOrPanic(&pb.Resource{
PolicyRef: policies.ChannelApplicationAdmins,
}),
ModPolicy: policies.ChannelApplicationAdmins,
},
"QSCC.Example2": &cb.ConfigValue{
Value: utils.MarshalOrPanic(&pb.Resource{
PolicyRef: "Example",
}),
ModPolicy: policies.ChannelApplicationAdmins,
},
},
Policies: map[string]*cb.ConfigPolicy{
"Example": &cb.ConfigPolicy{
Policy: &cb.Policy{
Type: int32(cb.Policy_SIGNATURE),
Value: utils.MarshalOrPanic(cauthdsl.AcceptAllPolicy),
},
ModPolicy: "Example",
},
},
ModPolicy: policies.ChannelApplicationAdmins,
},
}),
},
}),
}, nil
}
Expand Down

0 comments on commit 9a4172e

Please sign in to comment.