Commit f5ab160 Jason Yellick
committed
1 parent 63e54d1 commit f5ab160 Copy full SHA for f5ab160
File tree 5 files changed +20
-40
lines changed
common/configtx/handlers/application
5 files changed +20
-40
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ var Schema = &cb.ConfigGroupSchema{
57
57
58
58
// Peer config keys
59
59
const (
60
- // AnchorPeersKey is the cb.ConfigItem type key name for the AnchorPeers message
60
+ // AnchorPeersKey is the key name for the AnchorPeers ConfigValue
61
61
AnchorPeersKey = "AnchorPeers"
62
62
)
63
63
Original file line number Diff line number Diff line change @@ -37,8 +37,11 @@ func makeInvalidConfigValue() *cb.ConfigValue {
37
37
}
38
38
}
39
39
40
- func itemToValue (configItem * cb.ConfigItem ) (string , * cb.ConfigValue ) {
41
- return configItem .Key , & cb.ConfigValue {Value : configItem .Value }
40
+ func groupToKeyValue (configGroup * cb.ConfigGroup ) (string , * cb.ConfigValue ) {
41
+ for key , value := range configGroup .Groups [GroupKey ].Values {
42
+ return key , value
43
+ }
44
+ panic ("No value encoded" )
42
45
}
43
46
44
47
func TestInterface (t * testing.T ) {
@@ -92,7 +95,7 @@ func TestAnchorPeers(t *testing.T) {
92
95
t .Fatalf ("Should have failed on invalid message" )
93
96
}
94
97
95
- err = m .ProposeConfig (itemToValue (validMessage ))
98
+ err = m .ProposeConfig (groupToKeyValue (validMessage ))
96
99
if err != nil {
97
100
t .Fatalf ("Error applying valid config: %s" , err )
98
101
}
Original file line number Diff line number Diff line change @@ -24,16 +24,21 @@ import (
24
24
25
25
var defaultAnchorPeers = []* pb.AnchorPeer {}
26
26
27
- // TemplateAnchorPeers creates a headerless config item representing the anchor peers
28
- func TemplateAnchorPeers (anchorPeers []* pb.AnchorPeer ) * cb.ConfigItem {
29
- return & cb.ConfigItem {
30
- Type : cb .ConfigItem_PEER ,
31
- Key : AnchorPeersKey ,
32
- Value : utils .MarshalOrPanic (& pb.AnchorPeers {AnchorPeers : anchorPeers }),
27
+ func configGroup (key string , value []byte ) * cb.ConfigGroup {
28
+ result := cb .NewConfigGroup ()
29
+ result .Groups [GroupKey ] = cb .NewConfigGroup ()
30
+ result .Groups [GroupKey ].Values [key ] = & cb.ConfigValue {
31
+ Value : value ,
33
32
}
33
+ return result
34
+ }
35
+
36
+ // TemplateAnchorPeers creates a headerless config item representing the anchor peers
37
+ func TemplateAnchorPeers (anchorPeers []* pb.AnchorPeer ) * cb.ConfigGroup {
38
+ return configGroup (AnchorPeersKey , utils .MarshalOrPanic (& pb.AnchorPeers {AnchorPeers : anchorPeers }))
34
39
}
35
40
36
41
// DefaultAnchorPeers creates a headerless config item for the default orderer addresses
37
- func DefaultAnchorPeers () * cb.ConfigItem {
42
+ func DefaultAnchorPeers () * cb.ConfigGroup {
38
43
return TemplateAnchorPeers (defaultAnchorPeers )
39
44
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ func sendCreateChainTransaction(cf *ChannelCmdFactory) error {
55
55
//TODO this is a temporary hack until `orderer.template` and 'msp.template' is supplied from the CLI
56
56
oTemplate := configtxtest .OrdererTemplate ()
57
57
mspTemplate := configtxtest .MSPTemplate ()
58
- gossTemplate := configtx .NewSimpleTemplate (configtxapplication .TemplateAnchorPeers (anchorPeers ))
58
+ gossTemplate := configtx .NewSimpleTemplateNext (configtxapplication .TemplateAnchorPeers (anchorPeers ))
59
59
chCrtTemp := configtx .NewCompositeTemplate (oTemplate , mspTemplate , gossTemplate )
60
60
61
61
signer , err := mspmgmt .GetLocalMSP ().GetDefaultSigningIdentity ()
You can’t perform that action at this time.
0 commit comments