Skip to content

Commit 07d9bf8

Browse files
author
Jason Yellick
committedAug 30, 2017
[FAB-5978] Protolator support for Capabilities msg
This CR defines the metadata necessary for the configtxlator / protolator to understand the new Capabilities type. It also adds an additional check to the protolator to not try to deeply marshal beyond non-string map fields which was discovered while attempting to support this new message. Change-Id: I34aecb30ad7bdf7a99f2e8db7e203be26a7488e8 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
1 parent 5e3d22c commit 07d9bf8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
 

‎common/tools/protolator/nested.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (nff nestedFieldFactory) NewProtoField(msg proto.Message, fieldName string,
6565
type nestedMapFieldFactory struct{}
6666

6767
func (nmff nestedMapFieldFactory) Handles(msg proto.Message, fieldName string, fieldType reflect.Type, fieldValue reflect.Value) bool {
68-
return fieldType.Kind() == reflect.Map && fieldType.Elem().AssignableTo(protoMsgType) && !fieldType.Elem().AssignableTo(timestampType)
68+
return fieldType.Kind() == reflect.Map && fieldType.Elem().AssignableTo(protoMsgType) && !fieldType.Elem().AssignableTo(timestampType) && fieldType.Key().Kind() == reflect.String
6969
}
7070

7171
func (nmff nestedMapFieldFactory) NewProtoField(msg proto.Message, fieldName string, fieldType reflect.Type, fieldValue reflect.Value) (protoField, error) {

‎protos/peer/configuration.go

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ func (ccv *DynamicApplicationConfigValue) VariablyOpaqueFieldProto(name string)
9999
return nil, fmt.Errorf("Not a marshaled field: %s", name)
100100
}
101101
switch ccv.name {
102+
case "Capabilities":
103+
return &common.Capabilities{}, nil
102104
default:
103105
return nil, fmt.Errorf("Unknown Application ConfigValue name: %s", ccv.name)
104106
}

0 commit comments

Comments
 (0)