This is an automated email from the ASF dual-hosted git repository.

cmorris pushed a commit to branch splitroles-blockchain
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-dta.git

commit 4dc8aa0692bac2973a5c3d50a09a2fc735790db0
Author: Christopher Morris <[email protected]>
AuthorDate: Mon Sep 23 09:49:51 2019 +0100

    Add OrderBeneficaryType to order protobuffer
---
 cmd/service/__debug_bin             | Bin 0 -> 42684380 bytes
 cmd/servicetester/e2e_test.sh       |   3 +
 cmd/servicetester/fulltest.sh       |   3 +-
 libs/documents/docs.pb.go           | 188 ++++++++++++++++++++++--------------
 libs/documents/docs.proto           |  26 +++--
 libs/documents/docs.validator.pb.go |   6 +-
 pkg/bitcoinplugin/helpers.go        |  42 ++++----
 pkg/bitcoinplugin/service.go        |   2 +-
 pkg/common/common.go                |   7 ++
 pkg/defaultservice/order.go         |   9 +-
 10 files changed, 176 insertions(+), 110 deletions(-)

diff --git a/cmd/service/__debug_bin b/cmd/service/__debug_bin
new file mode 100755
index 0000000..e894d4c
Binary files /dev/null and b/cmd/service/__debug_bin differ
diff --git a/cmd/servicetester/e2e_test.sh b/cmd/servicetester/e2e_test.sh
index 8ed21f3..678b364 100755
--- a/cmd/servicetester/e2e_test.sh
+++ b/cmd/servicetester/e2e_test.sh
@@ -9,6 +9,9 @@ apiURL="${1:-$defaultURL}"
 status () {
   #Determine if an extension is running
   statusOutput=$(curl -s -X GET "$apiURL/$apiVersion/status" -H "accept: */*" 
-H "Content-Type: application/json")
+
+echo "$apiURL/$apiVersion/status"
+
   identity=$(echo $statusOutput | jq .nodeCID)
   extensionVendor=$(echo $statusOutput | jq -r .extensionVendor)
   plugin=$(echo $statusOutput | jq -r .plugin)
diff --git a/cmd/servicetester/fulltest.sh b/cmd/servicetester/fulltest.sh
index fb75a10..9096052 100755
--- a/cmd/servicetester/fulltest.sh
+++ b/cmd/servicetester/fulltest.sh
@@ -28,9 +28,10 @@ test_plugin () {
     cd ../..
     start_server $1
     popd 
-    ./e2e_test.sh > /dev/null
+    ./e2e_test.sh #> /dev/null
     res=$?
     report "$1" $res 
+    
     kill -s int $pid
 }
 
diff --git a/libs/documents/docs.pb.go b/libs/documents/docs.pb.go
index bb74de9..9d1de4d 100644
--- a/libs/documents/docs.pb.go
+++ b/libs/documents/docs.pb.go
@@ -22,6 +22,34 @@ var _ = math.Inf
 // proto package needs to be updated.
 const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
 
+type OrderDocument_OrderBeneficiaryType int32
+
+const (
+       OrderDocument_Unspecified                  
OrderDocument_OrderBeneficiaryType = 0
+       OrderDocument_Beneficiary_Known_at_start   
OrderDocument_OrderBeneficiaryType = 1
+       OrderDocument_Beneficiary_Unknown_at_Start 
OrderDocument_OrderBeneficiaryType = 2
+)
+
+var OrderDocument_OrderBeneficiaryType_name = map[int32]string{
+       0: "Unspecified",
+       1: "Beneficiary_Known_at_start",
+       2: "Beneficiary_Unknown_at_Start",
+}
+
+var OrderDocument_OrderBeneficiaryType_value = map[string]int32{
+       "Unspecified":                  0,
+       "Beneficiary_Known_at_start":   1,
+       "Beneficiary_Unknown_at_Start": 2,
+}
+
+func (x OrderDocument_OrderBeneficiaryType) String() string {
+       return proto.EnumName(OrderDocument_OrderBeneficiaryType_name, int32(x))
+}
+
+func (OrderDocument_OrderBeneficiaryType) EnumDescriptor() ([]byte, []int) {
+       return fileDescriptor_2a25dace11219bce, []int{5, 0}
+}
+
 type SignedEnvelope struct {
        Signature            []byte   
`protobuf:"bytes,1,opt,name=Signature,proto3" json:"Signature,omitempty"`
        SignerCID            string   
`protobuf:"bytes,2,opt,name=SignerCID,proto3" json:"SignerCID,omitempty"`
@@ -386,18 +414,19 @@ func (m *IDDocument) GetTimestamp() int64 {
 }
 
 type OrderDocument struct {
-       Type                 string      
`protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"`
-       Coin                 int64       
`protobuf:"varint,2,opt,name=Coin,proto3" json:"Coin,omitempty"`
-       PrincipalCID         string      
`protobuf:"bytes,3,opt,name=PrincipalCID,proto3" json:"PrincipalCID,omitempty"`
-       BeneficiaryCID       string      
`protobuf:"bytes,4,opt,name=BeneficiaryCID,proto3" 
json:"BeneficiaryCID,omitempty"`
-       Reference            string      
`protobuf:"bytes,5,opt,name=Reference,proto3" json:"Reference,omitempty"`
-       Timestamp            int64       
`protobuf:"varint,6,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
-       OrderPart2           *OrderPart2 
`protobuf:"bytes,7,opt,name=OrderPart2,proto3" json:"OrderPart2,omitempty"`
-       OrderPart3           *OrderPart3 
`protobuf:"bytes,8,opt,name=OrderPart3,proto3" json:"OrderPart3,omitempty"`
-       OrderPart4           *OrderPart4 
`protobuf:"bytes,9,opt,name=OrderPart4,proto3" json:"OrderPart4,omitempty"`
-       XXX_NoUnkeyedLiteral struct{}    `json:"-"`
-       XXX_unrecognized     []byte      `json:"-"`
-       XXX_sizecache        int32       `json:"-"`
+       Type                 string                             
`protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"`
+       BeneficiaryType      OrderDocument_OrderBeneficiaryType 
`protobuf:"varint,2,opt,name=BeneficiaryType,proto3,enum=documents.OrderDocument_OrderBeneficiaryType"
 json:"BeneficiaryType,omitempty"`
+       Coin                 int64                              
`protobuf:"varint,3,opt,name=Coin,proto3" json:"Coin,omitempty"`
+       PrincipalCID         string                             
`protobuf:"bytes,4,opt,name=PrincipalCID,proto3" json:"PrincipalCID,omitempty"`
+       BeneficiaryCID       string                             
`protobuf:"bytes,5,opt,name=BeneficiaryCID,proto3" 
json:"BeneficiaryCID,omitempty"`
+       Reference            string                             
`protobuf:"bytes,6,opt,name=Reference,proto3" json:"Reference,omitempty"`
+       Timestamp            int64                              
`protobuf:"varint,7,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
+       OrderPart2           *OrderPart2                        
`protobuf:"bytes,8,opt,name=OrderPart2,proto3" json:"OrderPart2,omitempty"`
+       OrderPart3           *OrderPart3                        
`protobuf:"bytes,9,opt,name=OrderPart3,proto3" json:"OrderPart3,omitempty"`
+       OrderPart4           *OrderPart4                        
`protobuf:"bytes,10,opt,name=OrderPart4,proto3" json:"OrderPart4,omitempty"`
+       XXX_NoUnkeyedLiteral struct{}                           `json:"-"`
+       XXX_unrecognized     []byte                             `json:"-"`
+       XXX_sizecache        int32                              `json:"-"`
 }
 
 func (m *OrderDocument) Reset()         { *m = OrderDocument{} }
@@ -432,6 +461,13 @@ func (m *OrderDocument) GetType() string {
        return ""
 }
 
+func (m *OrderDocument) GetBeneficiaryType() 
OrderDocument_OrderBeneficiaryType {
+       if m != nil {
+               return m.BeneficiaryType
+       }
+       return OrderDocument_Unspecified
+}
+
 func (m *OrderDocument) GetCoin() int64 {
        if m != nil {
                return m.Coin
@@ -826,6 +862,7 @@ func (m *SimpleString) GetContent() string {
 }
 
 func init() {
+       proto.RegisterEnum("documents.OrderDocument_OrderBeneficiaryType", 
OrderDocument_OrderBeneficiaryType_name, 
OrderDocument_OrderBeneficiaryType_value)
        proto.RegisterType((*SignedEnvelope)(nil), "documents.SignedEnvelope")
        proto.RegisterType((*Envelope)(nil), "documents.Envelope")
        proto.RegisterType((*Header)(nil), "documents.Header")
@@ -844,65 +881,70 @@ func init() {
 func init() { proto.RegisterFile("docs.proto", 
fileDescriptor_2a25dace11219bce) }
 
 var fileDescriptor_2a25dace11219bce = []byte{
-       // 956 bytes of a gzipped FileDescriptorProto
-       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 
0x4f, 0x6f, 0x1b, 0x45,
-       0x14, 0xd7, 0xda, 0x8e, 0x13, 0xbf, 0xb8, 0x21, 0x9d, 0x26, 0xed, 0xaa, 
0x20, 0x12, 0xad, 0x22,
-       0x64, 0x24, 0xe2, 0x10, 0xdb, 0x8d, 0x20, 0x42, 0x42, 0xd8, 0x0e, 0x60, 
0xf1, 0xcf, 0x8c, 0xa3,
-       0x08, 0xa9, 0x6a, 0xa5, 0xc9, 0xee, 0x8b, 0x33, 0xaa, 0x77, 0x67, 0xb5, 
0x3b, 0x4e, 0xb1, 0x80,
-       0x33, 0x07, 0x8e, 0x9c, 0xb9, 0x20, 0xf5, 0xca, 0x11, 0xbe, 0x00, 0x47, 
0xbe, 0x43, 0x44, 0x0e,
-       0x20, 0xbe, 0x01, 0x37, 0xd0, 0xcc, 0xfe, 0x0f, 0x71, 0x93, 0x03, 0x52, 
0x7d, 0x9a, 0xf7, 0x7e,
-       0xef, 0xf7, 0xe6, 0xfd, 0x1d, 0x2f, 0x80, 0x23, 0xec, 0xb0, 0xe9, 0x07, 
0x42, 0x0a, 0x52, 0x73,
-       0x84, 0x3d, 0x75, 0xd1, 0x93, 0xe1, 0xfd, 0xbd, 0x31, 0x97, 0xa7, 0xd3, 
0xe3, 0xa6, 0x2d, 0xdc,
-       0x1d, 0xf7, 0x29, 0x97, 0x4f, 0xc4, 0xd3, 0x9d, 0xb1, 0xd8, 0xd6, 0x76, 
0xdb, 0x67, 0x6c, 0xc2,
-       0x1d, 0x26, 0x45, 0x10, 0xee, 0xa4, 0xc7, 0xc8, 0xc5, 0xfd, 0xed, 0x1c, 
0x6f, 0x2c, 0xc6, 0x62,
-       0x47, 0xab, 0x8f, 0xa7, 0x27, 0x5a, 0xd2, 0x82, 0x3e, 0x45, 0xe6, 0xd6, 
0x77, 0x06, 0xac, 0x8c,
-       0xf8, 0xd8, 0x43, 0xe7, 0xc0, 0x3b, 0xc3, 0x89, 0xf0, 0x91, 0x6c, 0x41, 
0x4d, 0x69, 0x98, 0x9c,
-       0x06, 0x68, 0x1a, 0x9b, 0x46, 0xa3, 0xde, 0xad, 0x5e, 0x9c, 0x6f, 0x94, 
0xfc, 0x35, 0x9a, 0x01,
-       0xe4, 0xed, 0xc8, 0x0a, 0x83, 0xde, 0xa0, 0x6f, 0x96, 0x36, 0x8d, 0x46, 
0xad, 0xfb, 0xf2, 0xc5,
-       0xf9, 0xc6, 0x3d, 0x58, 0x7f, 0xfc, 0xf9, 0xc3, 0x87, 0xfb, 0x6c, 0xe2, 
0x4d, 0xdd, 0xfd, 0x47,
-       0x8f, 0xbe, 0xea, 0x3c, 0xf8, 0x66, 0xeb, 0xeb, 0xc7, 0x5b, 0x34, 0xb3, 
0x26, 0x26, 0x2c, 0x7e,
-       0x82, 0x61, 0xc8, 0xc6, 0x68, 0x96, 0x95, 0x7b, 0x9a, 0x88, 0x96, 0x80, 
0xa5, 0x34, 0x8c, 0xd7,
-       0xa1, 0xfa, 0x21, 0x32, 0x07, 0x03, 0x1d, 0xc3, 0x72, 0xeb, 0x76, 0x33, 
0x2d, 0x4e, 0x33, 0x02,
-       0x68, 0x6c, 0x40, 0x08, 0x54, 0xba, 0xc2, 0x99, 0xe9, 0x30, 0xea, 0x54, 
0x9f, 0xc9, 0x16, 0xdc,
-       0x3a, 0xf0, 0xec, 0x60, 0xe6, 0x4b, 0x74, 0x34, 0x18, 0x5d, 0x55, 0x54, 
0x5a, 0x3f, 0x96, 0x93,
-       0x5b, 0xc8, 0x5d, 0xa8, 0x0e, 0x86, 0xef, 0x8f, 0x06, 0x7d, 0x7d, 0x5f, 
0x8d, 0xc6, 0x92, 0x8a,
-       0xf6, 0x08, 0x83, 0x90, 0x0b, 0x4f, 0xfb, 0x2f, 0xd1, 0x44, 0x24, 0x6f, 
0xc0, 0x52, 0x9f, 0x49,
-       0x3c, 0xe4, 0x6e, 0x94, 0x48, 0xb9, 0xbb, 0x7a, 0x71, 0xbe, 0x51, 0x5f, 
0x7d, 0xf6, 0xed, 0x1f,
-       0x7f, 0x2d, 0x98, 0xcf, 0x7e, 0xfd, 0xf9, 0xfb, 0x19, 0x4d, 0x2d, 0xc8, 
0x26, 0x2c, 0x0f, 0x03,
-       0x3c, 0xe3, 0x62, 0x1a, 0xaa, 0x92, 0x55, 0xf4, 0x25, 0x79, 0x15, 0xb1, 
0xa0, 0xae, 0x82, 0x3a,
-       0x9c, 0xf9, 0xd8, 0x13, 0x0e, 0x9a, 0x0b, 0xfa, 0xba, 0x82, 0x4e, 0x79, 
0x51, 0x72, 0x12, 0x51,
-       0x55, 0x9b, 0xe4, 0x55, 0xa4, 0x03, 0xeb, 0x85, 0x1c, 0x53, 0x77, 0x8b, 
0xda, 0xf6, 0x6a, 0x90,
-       0xb4, 0x60, 0xad, 0x00, 0x24, 0x17, 0x2c, 0x69, 0xd2, 0x95, 0x18, 0x69, 
0xc0, 0x4b, 0x05, 0xfd,
-       0xe0, 0xc8, 0xac, 0xe9, 0x22, 0x5f, 0x56, 0x93, 0x77, 0x00, 0x28, 0xda, 
0xdc, 0xe7, 0xaa, 0x7b,
-       0x26, 0x6c, 0x96, 0x1b, 0xcb, 0xad, 0xb5, 0x5c, 0x3f, 0x53, 0x30, 0x9a, 
0xb4, 0xd3, 0x35, 0x9a,
-       0xb3, 0xb7, 0x7e, 0x32, 0xa0, 0x96, 0x8a, 0xf9, 0x7e, 0x18, 0xc5, 0x7e, 
0x6c, 0x43, 0xf9, 0x86,
-       0xc3, 0xa8, 0xec, 0xe2, 0xf0, 0x99, 0x1f, 0x4e, 0x27, 0x4c, 0xa2, 0xf3, 
0x11, 0x26, 0x33, 0x72,
-       0x59, 0x4d, 0x5e, 0x05, 0xe8, 0x71, 0xff, 0x14, 0x83, 0x43, 0xfc, 0x52, 
0xea, 0xce, 0xd5, 0x69,
-       0x4e, 0x43, 0x56, 0xa0, 0x34, 0x38, 0xd2, 0xed, 0xaa, 0xd3, 0xd2, 0xe0, 
0xc8, 0xfa, 0xdb, 0x00,
-       0x18, 0xf4, 0xfb, 0x71, 0x7a, 0xe4, 0x2d, 0xb8, 0xf7, 0xde, 0x54, 0x9e, 
0xa2, 0x27, 0xb9, 0xcd,
-       0x24, 0x17, 0x1e, 0xc5, 0x13, 0x0c, 0xd0, 0xb3, 0x31, 0x1e, 0xb5, 0x79, 
0x30, 0xd9, 0x83, 0xbb,
-       0x5d, 0xf4, 0xf0, 0x84, 0xdb, 0x9c, 0x05, 0xb3, 0x83, 0xde, 0x70, 0x7a, 
0x3c, 0xe1, 0xb6, 0x8a,
-       0x34, 0x1a, 0xf5, 0x39, 0xa8, 0x1a, 0xfe, 0x11, 0x7f, 0x82, 0x99, 0x79, 
0x3c, 0xfc, 0x05, 0xa5,
-       0x9e, 0xb7, 0x8f, 0x47, 0x99, 0x51, 0x94, 0x58, 0x41, 0x47, 0x9a, 0x50, 
0x53, 0xd3, 0x1b, 0x4a,
-       0xe6, 0xfa, 0x3a, 0xc3, 0xab, 0x86, 0x3c, 0x33, 0xb1, 0x7e, 0x2b, 0xc3, 
0xad, 0xcf, 0x02, 0x07,
-       0x83, 0x34, 0x7b, 0x02, 0x15, 0x35, 0x65, 0x71, 0xaa, 0xfa, 0x4c, 0x5e, 
0x83, 0x4a, 0x4f, 0xf0,
-       0x68, 0xa1, 0xca, 0x5d, 0x72, 0x71, 0xbe, 0xb1, 0xb2, 0xfa, 0x4f, 0xf2, 
0x33, 0xcc, 0x3f, 0x17,
-       0xa9, 0xc6, 0xc9, 0xbb, 0x50, 0x1f, 0x06, 0xdc, 0xb3, 0xb9, 0xcf, 0x26, 
0xaa, 0xb5, 0xe5, 0xeb,
-       0x5b, 0x5b, 0x20, 0x90, 0x1e, 0xac, 0xe4, 0x4a, 0x94, 0xee, 0xdd, 0xf3, 
0x5d, 0x5c, 0xa2, 0xa8,
-       0x07, 0x31, 0xeb, 0xd8, 0x82, 0xe6, 0xeb, 0x31, 0xfd, 0xc2, 0xa0, 0x19, 
0x50, 0xac, 0x54, 0xf5,
-       0xda, 0x4a, 0x91, 0x07, 0x00, 0xba, 0x50, 0x43, 0x16, 0xc8, 0x96, 0x5e, 
0xce, 0xe5, 0xd6, 0x7a,
-       0x6e, 0x27, 0x32, 0x90, 0xe6, 0x0c, 0x0b, 0xb4, 0xb6, 0x5e, 0xcf, 0x39, 
0xb4, 0x76, 0x8e, 0xd6,
-       0x2e, 0xd0, 0x3a, 0x7a, 0x4d, 0xe7, 0xd0, 0x3a, 0x39, 0x5a, 0xc7, 0xfa, 
0xc5, 0xc8, 0x47, 0x49,
-       0xde, 0x84, 0x3b, 0x3d, 0xe1, 0xba, 0x5c, 0x2a, 0x52, 0x36, 0x38, 0x51, 
0x6b, 0xaf, 0x82, 0xc8,
-       0x07, 0xb0, 0x9a, 0x3c, 0x71, 0xda, 0xcf, 0x0d, 0x17, 0xf4, 0x3f, 0xa4, 
0x62, 0x79, 0xcb, 0xd7,
-       0x0f, 0xe2, 0xef, 0xf9, 0xc8, 0xdb, 0x6a, 0x85, 0x29, 0x3a, 0xe8, 0xfa, 
0x32, 0x79, 0x38, 0x6a,
-       0x34, 0xa7, 0xf9, 0xff, 0xe2, 0xdc, 0x07, 0x33, 0xbf, 0x94, 0xc9, 0x43, 
0xd8, 0x67, 0x92, 0xc5,
-       0x5b, 0x38, 0x17, 0x2f, 0xe6, 0x58, 0xb9, 0x3e, 0xc7, 0x1f, 0xf2, 0x39, 
0x76, 0xd4, 0x3f, 0xd8,
-       0x08, 0xed, 0x00, 0x65, 0xf2, 0x0f, 0x16, 0x49, 0x2f, 0xae, 0x07, 0x7b, 
0x50, 0x1d, 0x8a, 0x09,
-       0xb7, 0x67, 0xcf, 0x79, 0xb4, 0x09, 0x54, 0x3e, 0x65, 0x2e, 0x46, 0x01, 
0x51, 0x7d, 0xb6, 0x76,
-       0xe1, 0xf6, 0x70, 0xc2, 0xb8, 0x77, 0x88, 0xa1, 0x8c, 0x3f, 0x0d, 0x76, 
0xc9, 0x2b, 0x50, 0x53,
-       0xa0, 0xc4, 0x50, 0xee, 0xc6, 0x09, 0x66, 0x0a, 0xab, 0x0d, 0x77, 0xe2, 
0x5a, 0xce, 0x23, 0xb5,
-       0x2e, 0x93, 0x5a, 0x56, 0x03, 0xea, 0x23, 0xee, 0xfa, 0x13, 0x1c, 0xc9, 
0x80, 0x7b, 0x63, 0x15,
-       0x65, 0x4f, 0x78, 0x12, 0xbd, 0xa4, 0x82, 0x89, 0x78, 0x5c, 0xd5, 0x5f, 
0x4b, 0xed, 0x7f, 0x03,
-       0x00, 0x00, 0xff, 0xff, 0x54, 0x80, 0x91, 0x77, 0xad, 0x09, 0x00, 0x00,
+       // 1035 bytes of a gzipped FileDescriptorProto
+       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 
0xcf, 0x6e, 0x23, 0xc5,
+       0x13, 0xfe, 0x8d, 0xed, 0x38, 0x71, 0xc5, 0x9b, 0x78, 0x7b, 0x93, 0xdd, 
0x51, 0x7e, 0xab, 0x4d,
+       0x34, 0x8a, 0x50, 0x90, 0x48, 0x42, 0x6c, 0x6f, 0x04, 0x11, 0x12, 0x22, 
0x76, 0x00, 0x6b, 0xf9,
+       0x63, 0xc6, 0xd9, 0x80, 0xb4, 0xda, 0x8d, 0x26, 0x33, 0x15, 0xa7, 0x15, 
0x4f, 0xf7, 0x68, 0xa6,
+       0x9d, 0x60, 0x01, 0x67, 0x0e, 0x5c, 0x90, 0x38, 0x73, 0x41, 0xda, 0x2b, 
0x47, 0x78, 0x01, 0xde,
+       0x23, 0x22, 0x07, 0x10, 0x6f, 0xc0, 0x0d, 0xd4, 0x3d, 0x33, 0x76, 0x8f, 
0xb1, 0x37, 0x7b, 0x40,
+       0xc2, 0xa7, 0xae, 0xfa, 0xbe, 0xaa, 0xae, 0xea, 0xfa, 0xba, 0xc7, 0x00, 
0x1e, 0x77, 0xa3, 0xad,
+       0x20, 0xe4, 0x82, 0x93, 0x92, 0xc7, 0xdd, 0xbe, 0x8f, 0x4c, 0x44, 0x2b, 
0xbb, 0x5d, 0x2a, 0xce,
+       0xfa, 0x27, 0x5b, 0x2e, 0xf7, 0xb7, 0xfd, 0x4b, 0x2a, 0xce, 0xf9, 0xe5, 
0x76, 0x97, 0x6f, 0x2a,
+       0xde, 0xe6, 0x85, 0xd3, 0xa3, 0x9e, 0x23, 0x78, 0x18, 0x6d, 0x0f, 0x97, 
0x71, 0x8a, 0x95, 0x4d,
+       0x2d, 0xae, 0xcb, 0xbb, 0x7c, 0x5b, 0xb9, 0x4f, 0xfa, 0xa7, 0xca, 0x52, 
0x86, 0x5a, 0xc5, 0x74,
+       0xeb, 0x1b, 0x03, 0x16, 0x3a, 0xb4, 0xcb, 0xd0, 0x3b, 0x60, 0x17, 0xd8, 
0xe3, 0x01, 0x92, 0x75,
+       0x28, 0x49, 0x8f, 0x23, 0xfa, 0x21, 0x9a, 0xc6, 0x9a, 0xb1, 0x51, 0xde, 
0x2f, 0x5e, 0x5f, 0xad,
+       0xe6, 0x82, 0x25, 0x7b, 0x04, 0x90, 0x37, 0x63, 0x16, 0x86, 0x8d, 0x56, 
0xd3, 0xcc, 0xad, 0x19,
+       0x1b, 0xa5, 0xfd, 0xff, 0x5f, 0x5f, 0xad, 0xde, 0x83, 0xe5, 0x67, 0x9f, 
0x3c, 0x79, 0xb2, 0xe7,
+       0xf4, 0x58, 0xdf, 0xdf, 0x7b, 0xfa, 0xf4, 0x8b, 0xfa, 0xc3, 0xaf, 0xd6, 
0xbf, 0x7c, 0xb6, 0x6e,
+       0x8f, 0xd8, 0xc4, 0x84, 0xd9, 0x0f, 0x31, 0x8a, 0x9c, 0x2e, 0x9a, 0x79, 
0x99, 0xde, 0x4e, 0x4d,
+       0x8b, 0xc3, 0xdc, 0xb0, 0x8c, 0x57, 0xa1, 0xf8, 0x3e, 0x3a, 0x1e, 0x86, 
0xaa, 0x86, 0xf9, 0xea,
+       0xed, 0xad, 0xe1, 0xe1, 0x6c, 0xc5, 0x80, 0x9d, 0x10, 0x08, 0x81, 0xc2, 
0x3e, 0xf7, 0x06, 0xaa,
+       0x8c, 0xb2, 0xad, 0xd6, 0x64, 0x1d, 0x6e, 0x1d, 0x30, 0x37, 0x1c, 0x04, 
0x02, 0x3d, 0x05, 0xc6,
+       0x5b, 0x65, 0x9d, 0xd6, 0x0f, 0xf9, 0x74, 0x17, 0x72, 0x17, 0x8a, 0xad, 
0xf6, 0xbb, 0x9d, 0x56,
+       0x53, 0xed, 0x57, 0xb2, 0x13, 0x4b, 0x56, 0x7b, 0x84, 0x61, 0x44, 0x39, 
0x53, 0xf9, 0x73, 0x76,
+       0x6a, 0x92, 0xd7, 0x60, 0xae, 0xe9, 0x08, 0x3c, 0xa4, 0x7e, 0xdc, 0x48, 
0x7e, 0xbf, 0x72, 0x7d,
+       0xb5, 0x5a, 0xae, 0x3c, 0xff, 0xfa, 0xb7, 0x3f, 0x66, 0xcc, 0xe7, 0xbf, 
0xfc, 0xf4, 0xdd, 0xc0,
+       0x1e, 0x32, 0xc8, 0x1a, 0xcc, 0xb7, 0x43, 0xbc, 0xa0, 0xbc, 0x1f, 0xc9, 
0x23, 0x2b, 0xa8, 0x4d,
+       0x74, 0x17, 0xb1, 0xa0, 0x2c, 0x8b, 0x3a, 0x1c, 0x04, 0xd8, 0xe0, 0x1e, 
0x9a, 0x33, 0x6a, 0xbb,
+       0x8c, 0x4f, 0x66, 0x91, 0x76, 0x5a, 0x51, 0x51, 0x51, 0x74, 0x17, 0xa9, 
0xc3, 0x72, 0xa6, 0xc7,
+       0x61, 0xba, 0x59, 0xc5, 0x9d, 0x0c, 0x92, 0x2a, 0x2c, 0x65, 0x80, 0x74, 
0x83, 0x39, 0x15, 0x34,
+       0x11, 0x23, 0x1b, 0xb0, 0x98, 0xf1, 0xb7, 0x8e, 0xcc, 0x92, 0x3a, 0xe4, 
0x71, 0x37, 0x79, 0x0b,
+       0xc0, 0x46, 0x97, 0x06, 0x54, 0x4e, 0xcf, 0x84, 0xb5, 0xfc, 0xc6, 0x7c, 
0x75, 0x49, 0x9b, 0xe7,
+       0x10, 0x8c, 0x95, 0x76, 0xb6, 0x64, 0x6b, 0x7c, 0xeb, 0x47, 0x03, 0x4a, 
0x43, 0x53, 0x9f, 0x87,
+       0x91, 0x9d, 0xc7, 0x26, 0xe4, 0x5f, 0x52, 0x8c, 0x92, 0x97, 0x94, 0xef, 
0x04, 0x51, 0xbf, 0xe7,
+       0x08, 0xf4, 0x1e, 0x61, 0xaa, 0x91, 0x71, 0x37, 0x79, 0x00, 0xd0, 0xa0, 
0xc1, 0x19, 0x86, 0x87,
+       0xf8, 0xb9, 0x50, 0x93, 0x2b, 0xdb, 0x9a, 0x87, 0x2c, 0x40, 0xae, 0x75, 
0xa4, 0xc6, 0x55, 0xb6,
+       0x73, 0xad, 0x23, 0xeb, 0x4f, 0x03, 0xa0, 0xd5, 0x6c, 0x26, 0xed, 0x91, 
0x37, 0xe0, 0xde, 0x3b,
+       0x7d, 0x71, 0x86, 0x4c, 0x50, 0xd7, 0x11, 0x94, 0x33, 0x1b, 0x4f, 0x31, 
0x44, 0xe6, 0x62, 0x22,
+       0xb5, 0x69, 0x30, 0xd9, 0x85, 0xbb, 0xfb, 0xc8, 0xf0, 0x94, 0xba, 0xd4, 
0x09, 0x07, 0x07, 0x8d,
+       0x76, 0xff, 0xa4, 0x47, 0x5d, 0x59, 0x69, 0x2c, 0xf5, 0x29, 0xa8, 0x14, 
0x7f, 0x87, 0x9e, 0xe3,
+       0x88, 0x9e, 0x88, 0x3f, 0xe3, 0x54, 0x7a, 0xfb, 0xa0, 0x33, 0x22, 0xc5, 
0x8d, 0x65, 0x7c, 0x64,
+       0x0b, 0x4a, 0x52, 0xbd, 0x91, 0x70, 0xfc, 0x40, 0x75, 0x38, 0x49, 0xe4, 
0x23, 0x8a, 0xf5, 0xed,
+       0x0c, 0xdc, 0xfa, 0x38, 0xf4, 0x30, 0x1c, 0x76, 0x4f, 0xa0, 0x20, 0x55, 
0x96, 0xb4, 0xaa, 0xd6,
+       0xe4, 0x53, 0x58, 0xd4, 0x2a, 0x57, 0xb0, 0x6c, 0x68, 0xa1, 0xba, 0xa9, 
0x89, 0x22, 0x93, 0x26,
+       0xb6, 0xc6, 0x82, 0xec, 0xf1, 0x2c, 0xe4, 0x15, 0x28, 0x34, 0x38, 0x65, 
0xc9, 0x75, 0x24, 0xd7,
+       0x57, 0xab, 0x0b, 0x95, 0xbf, 0xd2, 0x9f, 0x61, 0xfe, 0x3e, 0x6b, 0x2b, 
0x9c, 0xbc, 0x0d, 0xe5,
+       0x76, 0x48, 0x99, 0x4b, 0x03, 0xa7, 0x37, 0xbc, 0x8d, 0x2f, 0xd6, 0x4c, 
0x26, 0x80, 0x34, 0x60,
+       0x41, 0xdb, 0x5b, 0xa6, 0x98, 0xb9, 0x39, 0xc5, 0x58, 0x88, 0x7c, 0x69, 
0x47, 0x52, 0x28, 0xaa,
+       0x78, 0xa5, 0xff, 0xcf, 0x0c, 0x7b, 0x04, 0x64, 0x47, 0x30, 0x7b, 0xe3, 
0x08, 0xc8, 0x43, 0x00,
+       0x75, 0x58, 0x6d, 0x27, 0x14, 0x55, 0x75, 0x81, 0xe7, 0xab, 0xcb, 0xe3, 
0xe7, 0xaa, 0x40, 0x5b,
+       0x23, 0x66, 0xc2, 0x6a, 0xea, 0x22, 0x4f, 0x09, 0xab, 0x69, 0x61, 0xb5, 
0x4c, 0x58, 0xdd, 0x84,
+       0xe9, 0x61, 0x75, 0x2d, 0xac, 0x6e, 0x51, 0x58, 0x9a, 0x34, 0x51, 0xb2, 
0x08, 0xf3, 0x8f, 0x59,
+       0x14, 0xa0, 0x4b, 0x4f, 0x29, 0x7a, 0x95, 0xff, 0x91, 0x07, 0xb0, 0xa2, 
0x71, 0x8e, 0x1f, 0x31,
+       0x7e, 0xc9, 0x8e, 0x1d, 0x71, 0x1c, 0x09, 0x27, 0x14, 0x15, 0x83, 0xac, 
0xc1, 0x7d, 0x1d, 0x7f,
+       0xcc, 0xce, 0x53, 0x46, 0x47, 0x31, 0x72, 0xd6, 0xcf, 0x86, 0x7e, 0x20, 
0xe4, 0x75, 0xb8, 0xd3,
+       0xe0, 0xbe, 0x4f, 0x85, 0xac, 0x6f, 0x24, 0xfe, 0x58, 0x9e, 0x93, 0x20, 
0xf2, 0x1e, 0x54, 0xd2,
+       0x67, 0x5a, 0xe5, 0x79, 0xc9, 0x47, 0xe6, 0x1f, 0x41, 0xd9, 0x49, 0xe6, 
0x6f, 0xbe, 0x4c, 0xbf,
+       0xea, 0x95, 0xd7, 0xe4, 0x33, 0x64, 0xa3, 0x87, 0x7e, 0x20, 0xd2, 0xc7, 
0xaf, 0x64, 0x6b, 0x9e,
+       0x7f, 0xaf, 0xce, 0x3d, 0x30, 0xf5, 0x87, 0x25, 0x7d, 0xcc, 0x9b, 0x8e, 
0x70, 0x92, 0x97, 0x64,
+       0x2a, 0x9e, 0xed, 0xb1, 0x70, 0x73, 0x8f, 0xdf, 0xeb, 0x3d, 0xd6, 0xe5, 
0x57, 0xb8, 0x83, 0x6e,
+       0x88, 0x22, 0xfd, 0x0a, 0xc7, 0xd6, 0x7f, 0x37, 0x83, 0x5d, 0x28, 0xb6, 
0x79, 0x8f, 0xba, 0x83,
+       0x17, 0x7c, 0x78, 0x08, 0x14, 0x3e, 0x72, 0xfc, 0xf8, 0x0d, 0x2b, 0xd9, 
0x6a, 0x6d, 0xed, 0xc0,
+       0xed, 0x76, 0xcf, 0xa1, 0xec, 0x10, 0x23, 0x91, 0xfc, 0xbd, 0xd9, 0x21, 
0xf7, 0xa1, 0x24, 0x41,
+       0x81, 0x91, 0xd8, 0x49, 0x1a, 0x1c, 0x39, 0xac, 0x1a, 0xdc, 0x49, 0xce, 
0x72, 0x5a, 0x50, 0x75,
+       0x3c, 0xa8, 0x6a, 0x6d, 0x40, 0xb9, 0x43, 0xfd, 0xa0, 0x87, 0x1d, 0x11, 
0x52, 0xd6, 0x95, 0x55,
+       0x36, 0x38, 0x13, 0xc8, 0xd2, 0x13, 0x4c, 0xcd, 0x93, 0xa2, 0xfa, 0xc7, 
0x57, 0xfb, 0x3b, 0x00,
+       0x00, 0xff, 0xff, 0x32, 0xfe, 0x78, 0x15, 0x71, 0x0a, 0x00, 0x00,
 }
diff --git a/libs/documents/docs.proto b/libs/documents/docs.proto
index 737d112..509a1b9 100644
--- a/libs/documents/docs.proto
+++ b/libs/documents/docs.proto
@@ -76,15 +76,23 @@ message IDDocument {
 
 
 message OrderDocument {
-    string Type              = 1; //This can be used to extend the types of 
things that an order can do.
-    int64 Coin               = 2 [(validator.field) = {int_gt: -1, int_lt: 
999}];
-    string PrincipalCID      = 3 [(validator.field) = {regex: 
"^Q[[:alnum:]]{45}$|^$"}];  //empty if ok
-    string BeneficiaryCID    = 4 [(validator.field) = {regex: 
"^Q[[:alnum:]]{45}$|^$"}];  //empty if ok
-    string Reference         = 5 [(validator.field) = 
{string_not_empty:true}]; //an id for this order e.g. walletID
-    int64 Timestamp          = 6 [(validator.field) = 
{int_gt:1564050341,int_lt:32521429541}];
-    OrderPart2 OrderPart2    = 7;
-    OrderPart3 OrderPart3    = 8;
-    OrderPart4 OrderPart4    = 9;
+    enum OrderBeneficiaryType {
+        Unspecified = 0;
+        Beneficiary_Known_at_start = 1;
+        Beneficiary_Unknown_at_Start = 2;
+    }
+
+
+    string Type           = 1; //This can be used to extend the types of 
things that an order can do.
+    OrderBeneficiaryType BeneficiaryType = 2;
+    int64 Coin               = 3 [(validator.field) = {int_gt: -1, int_lt: 
999}];
+    string PrincipalCID      = 4 [(validator.field) = {regex: 
"^Q[[:alnum:]]{45}$|^$"}];  //empty if ok
+    string BeneficiaryCID    = 5 [(validator.field) = {regex: 
"^Q[[:alnum:]]{45}$|^$"}];  //empty if ok
+    string Reference         = 6 [(validator.field) = 
{string_not_empty:true}]; //an id for this order e.g. walletID
+    int64 Timestamp          = 7 [(validator.field) = 
{int_gt:1564050341,int_lt:32521429541}];
+    OrderPart2 OrderPart2    = 8;
+    OrderPart3 OrderPart3    = 9;
+    OrderPart4 OrderPart4    = 10;
 }
 
 message OrderPart2 {
diff --git a/libs/documents/docs.validator.pb.go 
b/libs/documents/docs.validator.pb.go
index 905146b..c7b2cf8 100644
--- a/libs/documents/docs.validator.pb.go
+++ b/libs/documents/docs.validator.pb.go
@@ -5,12 +5,12 @@ package documents
 
 import (
        fmt "fmt"
-       _ "github.com/gogo/protobuf/gogoproto"
+       math "math"
        proto "github.com/golang/protobuf/proto"
        _ "github.com/mwitkow/go-proto-validators"
-       github_com_mwitkow_go_proto_validators 
"github.com/mwitkow/go-proto-validators"
-       math "math"
+       _ "github.com/gogo/protobuf/gogoproto"
        regexp "regexp"
+       github_com_mwitkow_go_proto_validators 
"github.com/mwitkow/go-proto-validators"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.
diff --git a/pkg/bitcoinplugin/helpers.go b/pkg/bitcoinplugin/helpers.go
index eb65167..42ed32f 100644
--- a/pkg/bitcoinplugin/helpers.go
+++ b/pkg/bitcoinplugin/helpers.go
@@ -31,7 +31,9 @@ import (
 )
 
 func deriveFinalPrivateKey(s *Service, order documents.OrderDoc, 
beneficiariesSikeSK []byte, beneficiariesSeed []byte, beneficiaryIDDocumentCID 
string, nodeID string, signingBlsPK []byte) (string, error) {
-       if beneficiaryIDDocumentCID != "" {
+
+       switch order.BeneficiaryType {
+       case documents.OrderDocument_Beneficiary_Unknown_at_Start:
                //we are using the beneficiary specified in order Part 3
                beneficiaryBlob := order.OrderPart3.BeneficiaryEncryptedData
 
@@ -49,26 +51,28 @@ func deriveFinalPrivateKey(s *Service, order 
documents.OrderDoc, beneficiariesSi
                        return "", err
                }
                return finalPrivateKey, err
-       }
 
-       //we are using the beneficiary specified in the order part 1
-       privateKeyPart2of2 := order.OrderDocument.OrderPart4.Secret
-       // if order.OrderDocument.BeneficiaryCID != nodeID {
-       //      //need to forward this data to the beneficiary to complete 
redemption
-       //      return "", errors.New("Currently beneficiary must be the same 
as the Principal")
-       // }
-       //restore the Seed
-       _, _, ecAddPrivateKey, err := 
cryptowallet.Bip44Address(beneficiariesSeed, cryptowallet.CoinTypeBitcoinMain, 
0, 0, 0)
-       if err != nil {
-               return "", err
-       }
-       privateKeyPart1of1 := hex.EncodeToString(ecAddPrivateKey.Serialize())
-       finalPrivateKey, err := addPrivateKeys(privateKeyPart1of1, 
privateKeyPart2of2)
-       if err != nil {
-               return "", err
+       case documents.OrderDocument_Beneficiary_Known_at_start:
+               //we are using the beneficiary specified in the order part 1
+               privateKeyPart2of2 := order.OrderDocument.OrderPart4.Secret
+               // if order.OrderDocument.BeneficiaryCID != nodeID {
+               //      //need to forward this data to the beneficiary to 
complete redemption
+               //      return "", errors.New("Currently beneficiary must be 
the same as the Principal")
+               // }
+               //restore the Seed
+               _, _, ecAddPrivateKey, err := 
cryptowallet.Bip44Address(beneficiariesSeed, cryptowallet.CoinTypeBitcoinMain, 
0, 0, 0)
+               if err != nil {
+                       return "", err
+               }
+               privateKeyPart1of1 := 
hex.EncodeToString(ecAddPrivateKey.Serialize())
+               finalPrivateKey, err := addPrivateKeys(privateKeyPart1of1, 
privateKeyPart2of2)
+               if err != nil {
+                       return "", err
+               }
+               return finalPrivateKey, err
+       default:
+               return "", errors.New("Critical Error Unknown Beneficiary Type")
        }
-       return finalPrivateKey, err
-
 }
 
 func adhocEncryptedEnvelopeEncode(s *Service, nodeID string, 
beneficiaryIDDocumentCID string, order documents.OrderDoc, blsSK []byte) 
([]byte, error) {
diff --git a/pkg/bitcoinplugin/service.go b/pkg/bitcoinplugin/service.go
index f087855..2071fc7 100644
--- a/pkg/bitcoinplugin/service.go
+++ b/pkg/bitcoinplugin/service.go
@@ -71,7 +71,7 @@ func (s *Service) ValidateOrderSecretRequest(req 
*api.OrderSecretRequest, order
        //These are deliberately overly long winded, but it makes the case I'm 
trapping more obvious to the reader
 
        //There is no beneficiary supplided in either the Deposit or Redemption
-       if order.BeneficiaryCID == "" && req.BeneficiaryIDDocumentCID == "" {
+       if order.BeneficiaryType == documents.OrderDocument_Unspecified && 
req.BeneficiaryIDDocumentCID == "" {
                return errors.New("Beneficiary must be supplied")
        }
 
diff --git a/pkg/common/common.go b/pkg/common/common.go
index b8b6b0c..9b306a8 100644
--- a/pkg/common/common.go
+++ b/pkg/common/common.go
@@ -53,6 +53,13 @@ func CreateNewDepositOrder(BeneficiaryIDDocumentCID string, 
nodeID string) (*doc
                return nil, err
        }
        order := documents.NewOrderDoc()
+
+       if BeneficiaryIDDocumentCID == "" {
+               order.BeneficiaryType = 
documents.OrderDocument_Beneficiary_Unknown_at_Start
+       } else {
+               order.BeneficiaryType = 
documents.OrderDocument_Beneficiary_Known_at_start
+       }
+
        //oder.Type will be used to extend the things that an order can do.
        order.Type = "Safeguard_Secret"
        order.PrincipalCID = nodeID
diff --git a/pkg/defaultservice/order.go b/pkg/defaultservice/order.go
index 4326ba0..0ee77f9 100644
--- a/pkg/defaultservice/order.go
+++ b/pkg/defaultservice/order.go
@@ -214,11 +214,16 @@ func (s *Service) OrderSecret(req 
*api.OrderSecretRequest) (*api.OrderSecretResp
        }
 
        //Retrieve the order from IPFS
+
        order, err := common.RetrieveOrderFromIPFS(s.Ipfs, orderPart2CID, 
sikeSK, nodeID, remoteIDDoc.BLSPublicKey)
        if err != nil {
                return nil, errors.Wrap(err, "Fail to retrieve Order from IPFS")
        }
 
+       if err := s.Plugin.ValidateOrderSecretRequest(req, *order); err != nil {
+               return nil, err
+       }
+
        var beneficiariesSikeSK []byte
        var beneficiaryCID string
 
@@ -233,10 +238,6 @@ func (s *Service) OrderSecret(req *api.OrderSecretRequest) 
(*api.OrderSecretResp
                return nil, err
        }
 
-       if err := s.Plugin.ValidateOrderSecretRequest(req, *order); err != nil {
-               return nil, err
-       }
-
        //Create a piece of data that is destined for the beneficiary, passed 
via the Master Fiduciary
 
        beneficiaryEncryptedData, extension, err := 
s.Plugin.ProduceBeneficiaryEncryptedData(blsSK, order, req)

Reply via email to