@@ -25,49 +25,45 @@ import (
25
25
26
26
const defaultHashingAlgorithm = SHA3Shake256
27
27
28
- // TemplateHashingAlgorithm creates a headerless config item representing the hashing algorithm
29
- func TemplateHashingAlgorithm (name string ) * cb.ConfigItem {
30
- return & cb.ConfigItem {
31
- Type : cb .ConfigItem_CHAIN ,
32
- Key : HashingAlgorithmKey ,
33
- Value : utils .MarshalOrPanic (& cb.HashingAlgorithm {Name : name }),
28
+ func configGroup (key string , value []byte ) * cb.ConfigGroup {
29
+ result := cb .NewConfigGroup ()
30
+ result .Values [key ] = & cb.ConfigValue {
31
+ Value : value ,
34
32
}
33
+ return result
34
+ }
35
+
36
+ // TemplateHashingAlgorithm creates a ConfigGroup representing the HashingAlgorithm
37
+ func TemplateHashingAlgorithm (name string ) * cb.ConfigGroup {
38
+ return configGroup (HashingAlgorithmKey , utils .MarshalOrPanic (& cb.HashingAlgorithm {Name : name }))
35
39
36
40
}
37
41
38
42
// DefaultHashingAlgorithm creates a headerless config item for the default hashing algorithm
39
- func DefaultHashingAlgorithm () * cb.ConfigItem {
43
+ func DefaultHashingAlgorithm () * cb.ConfigGroup {
40
44
return TemplateHashingAlgorithm (defaultHashingAlgorithm )
41
45
}
42
46
43
47
const defaultBlockDataHashingStructureWidth = math .MaxUint32
44
48
45
49
// TemplateBlockDataHashingStructure creates a headerless config item representing the block data hashing structure
46
- func TemplateBlockDataHashingStructure (width uint32 ) * cb.ConfigItem {
47
- return & cb.ConfigItem {
48
- Type : cb .ConfigItem_CHAIN ,
49
- Key : BlockDataHashingStructureKey ,
50
- Value : utils .MarshalOrPanic (& cb.BlockDataHashingStructure {Width : width }),
51
- }
50
+ func TemplateBlockDataHashingStructure (width uint32 ) * cb.ConfigGroup {
51
+ return configGroup (BlockDataHashingStructureKey , utils .MarshalOrPanic (& cb.BlockDataHashingStructure {Width : width }))
52
52
}
53
53
54
54
// DefaultBlockDatahashingStructure creates a headerless config item for the default block data hashing structure
55
- func DefaultBlockDataHashingStructure () * cb.ConfigItem {
55
+ func DefaultBlockDataHashingStructure () * cb.ConfigGroup {
56
56
return TemplateBlockDataHashingStructure (defaultBlockDataHashingStructureWidth )
57
57
}
58
58
59
59
var defaultOrdererAddresses = []string {"127.0.0.1:7050" }
60
60
61
61
// TemplateOrdererAddressess creates a headerless config item representing the orderer addresses
62
- func TemplateOrdererAddresses (addresses []string ) * cb.ConfigItem {
63
- return & cb.ConfigItem {
64
- Type : cb .ConfigItem_CHAIN ,
65
- Key : OrdererAddressesKey ,
66
- Value : utils .MarshalOrPanic (& cb.OrdererAddresses {Addresses : addresses }),
67
- }
62
+ func TemplateOrdererAddresses (addresses []string ) * cb.ConfigGroup {
63
+ return configGroup (OrdererAddressesKey , utils .MarshalOrPanic (& cb.OrdererAddresses {Addresses : addresses }))
68
64
}
69
65
70
66
// DefaultOrdererAddresses creates a headerless config item for the default orderer addresses
71
- func DefaultOrdererAddresses () * cb.ConfigItem {
67
+ func DefaultOrdererAddresses () * cb.ConfigGroup {
72
68
return TemplateOrdererAddresses (defaultOrdererAddresses )
73
69
}
0 commit comments