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


The following commit(s) were added to refs/heads/splitroles-blockchain by this 
push:
     new ab002a8  Fix safeguard secret
ab002a8 is described below

commit ab002a8a4795896bb80999269337f32c7ec28cd1
Author: Christopher Morris <[email protected]>
AuthorDate: Tue Oct 1 12:19:08 2019 +0100

    Fix safeguard secret
---
 libs/documents/docs.pb.go           | 188 +++++++++++++++++++-----------------
 libs/documents/docs.proto           |   4 +-
 libs/documents/docs.validator.pb.go |   1 +
 pkg/config/config.go                |  16 ++-
 pkg/config/default.go               |  17 +++-
 pkg/defaultservice/order.go         |  23 ++++-
 pkg/safeguardsecret/service.go      |  23 +++--
 pkg/tendermint/tendermint.go        |  53 ++--------
 pkg/tendermint/websockets.go        | 120 ++---------------------
 9 files changed, 175 insertions(+), 270 deletions(-)

diff --git a/libs/documents/docs.pb.go b/libs/documents/docs.pb.go
index 1ca6248..b8fe2ee 100644
--- a/libs/documents/docs.pb.go
+++ b/libs/documents/docs.pb.go
@@ -414,20 +414,21 @@ func (m *IDDocument) GetTimestamp() int64 {
 }
 
 type OrderDocument struct {
-       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"`
-       Extension            map[string]string                  
`protobuf:"bytes,11,rep,name=Extension,proto3" json:"Extension,omitempty" 
protobuf_key:"bytes,1,opt,name=key,proto3" 
protobuf_val:"bytes,2,opt,name=value,proto3"`
-       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"`
+       OrderReqExtension       map[string]string                  
`protobuf:"bytes,11,rep,name=OrderReqExtension,proto3" 
json:"OrderReqExtension,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" 
protobuf_val:"bytes,2,opt,name=value,proto3"`
+       OrderSecretReqExtension map[string]string                  
`protobuf:"bytes,12,rep,name=OrderSecretReqExtension,proto3" 
json:"OrderSecretReqExtension,omitempty" 
protobuf_key:"bytes,1,opt,name=key,proto3" 
protobuf_val:"bytes,2,opt,name=value,proto3"`
+       XXX_NoUnkeyedLiteral    struct{}                           `json:"-"`
+       XXX_unrecognized        []byte                             `json:"-"`
+       XXX_sizecache           int32                              `json:"-"`
 }
 
 func (m *OrderDocument) Reset()         { *m = OrderDocument{} }
@@ -525,9 +526,16 @@ func (m *OrderDocument) GetOrderPart4() *OrderPart4 {
        return nil
 }
 
-func (m *OrderDocument) GetExtension() map[string]string {
+func (m *OrderDocument) GetOrderReqExtension() map[string]string {
        if m != nil {
-               return m.Extension
+               return m.OrderReqExtension
+       }
+       return nil
+}
+
+func (m *OrderDocument) GetOrderSecretReqExtension() map[string]string {
+       if m != nil {
+               return m.OrderSecretReqExtension
        }
        return nil
 }
@@ -901,7 +909,8 @@ func init() {
        proto.RegisterType((*Recipient)(nil), "documents.Recipient")
        proto.RegisterType((*IDDocument)(nil), "documents.IDDocument")
        proto.RegisterType((*OrderDocument)(nil), "documents.OrderDocument")
-       proto.RegisterMapType((map[string]string)(nil), 
"documents.OrderDocument.ExtensionEntry")
+       proto.RegisterMapType((map[string]string)(nil), 
"documents.OrderDocument.OrderReqExtensionEntry")
+       proto.RegisterMapType((map[string]string)(nil), 
"documents.OrderDocument.OrderSecretReqExtensionEntry")
        proto.RegisterType((*OrderPart2)(nil), "documents.OrderPart2")
        proto.RegisterMapType((map[string]string)(nil), 
"documents.OrderPart2.ExtensionEntry")
        proto.RegisterType((*OrderPart3)(nil), "documents.OrderPart3")
@@ -917,75 +926,78 @@ func init() {
 func init() { proto.RegisterFile("docs.proto", 
fileDescriptor_2a25dace11219bce) }
 
 var fileDescriptor_2a25dace11219bce = []byte{
-       // 1112 bytes of a gzipped FileDescriptorProto
-       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 
0xcf, 0x6f, 0x1b, 0x45,
-       0x14, 0x66, 0x6d, 0xc7, 0xe9, 0x3e, 0xbb, 0xae, 0x3b, 0x75, 0xdb, 0x55, 
0xa8, 0x9a, 0x68, 0x15,
-       0x41, 0x90, 0x48, 0x42, 0x6c, 0x37, 0x2a, 0x51, 0x25, 0x84, 0x7f, 0x00, 
0x56, 0xf9, 0x61, 0xd6,
-       0x69, 0x40, 0xaa, 0xda, 0x68, 0xb3, 0x3b, 0x71, 0x46, 0xf1, 0xce, 0xac, 
0x76, 0xc7, 0x49, 0x2d,
-       0xe0, 0xcc, 0x81, 0x23, 0xe2, 0x8c, 0x84, 0xd4, 0x2b, 0x47, 0x24, 0xee, 
0xfc, 0x1f, 0x91, 0x82,
-       0x04, 0xe2, 0x3f, 0xe0, 0x06, 0x9a, 0xd9, 0x5d, 0x7b, 0xd6, 0xd8, 0x4d, 
0x91, 0x88, 0x84, 0x4f,
-       0xf3, 0xde, 0xf7, 0xbd, 0x37, 0x6f, 0xde, 0xfb, 0x66, 0xbc, 0x00, 0x2e, 
0x73, 0xc2, 0x0d, 0x3f,
-       0x60, 0x9c, 0x21, 0xdd, 0x65, 0xce, 0xd0, 0xc3, 0x94, 0x87, 0x4b, 0xdb, 
0x7d, 0xc2, 0x8f, 0x86,
-       0x07, 0x1b, 0x0e, 0xf3, 0x36, 0xbd, 0x53, 0xc2, 0x8f, 0xd9, 0xe9, 0x66, 
0x9f, 0xad, 0x4b, 0xde,
-       0xfa, 0x89, 0x3d, 0x20, 0xae, 0xcd, 0x59, 0x10, 0x6e, 0x8e, 0x97, 0x51, 
0x8a, 0xa5, 0x75, 0x25,
-       0xae, 0xcf, 0xfa, 0x6c, 0x53, 0xba, 0x0f, 0x86, 0x87, 0xd2, 0x92, 0x86, 
0x5c, 0x45, 0x74, 0xf3,
-       0x1b, 0x0d, 0x4a, 0x3d, 0xd2, 0xa7, 0xd8, 0x6d, 0xd3, 0x13, 0x3c, 0x60, 
0x3e, 0x46, 0xab, 0xa0,
-       0x0b, 0x8f, 0xcd, 0x87, 0x01, 0x36, 0xb4, 0x15, 0x6d, 0xad, 0xd8, 0xc8, 
0x9f, 0x9f, 0x2d, 0x67,
-       0xfc, 0x8a, 0x35, 0x01, 0xd0, 0xdb, 0x11, 0x0b, 0x07, 0xcd, 0x4e, 0xcb, 
0xc8, 0xac, 0x68, 0x6b,
-       0x7a, 0xe3, 0xd5, 0xf3, 0xb3, 0xe5, 0xdb, 0x70, 0xf3, 0xe9, 0xa7, 0x8f, 
0x1f, 0xef, 0xd8, 0x03,
-       0x3a, 0xf4, 0x76, 0x9e, 0x3c, 0xf9, 0xa2, 0x7e, 0xef, 0xab, 0xd5, 0x2f, 
0x9f, 0xae, 0x5a, 0x13,
-       0x36, 0x32, 0x60, 0xf1, 0x23, 0x1c, 0x86, 0x76, 0x1f, 0x1b, 0x59, 0x91, 
0xde, 0x4a, 0x4c, 0x93,
-       0xc1, 0x95, 0x71, 0x19, 0x6f, 0x40, 0xfe, 0x03, 0x6c, 0xbb, 0x38, 0x90, 
0x35, 0x14, 0xaa, 0xd7,
-       0x37, 0xc6, 0xcd, 0xd9, 0x88, 0x00, 0x2b, 0x26, 0x20, 0x04, 0xb9, 0x06, 
0x73, 0x47, 0xb2, 0x8c,
-       0xa2, 0x25, 0xd7, 0x68, 0x15, 0xae, 0xb6, 0xa9, 0x13, 0x8c, 0x7c, 0x8e, 
0x5d, 0x09, 0x46, 0x5b,
-       0xa5, 0x9d, 0xe6, 0x0f, 0xd9, 0x64, 0x17, 0x74, 0x0b, 0xf2, 0x9d, 0xee, 
0x7b, 0xbd, 0x4e, 0x4b,
-       0xee, 0xa7, 0x5b, 0xb1, 0x25, 0xaa, 0xdd, 0xc3, 0x41, 0x48, 0x18, 0x95, 
0xf9, 0x33, 0x56, 0x62,
-       0xa2, 0x37, 0xe1, 0x4a, 0xcb, 0xe6, 0x78, 0x97, 0x78, 0xd1, 0x41, 0xb2, 
0x8d, 0xf2, 0xf9, 0xd9,
-       0x72, 0xb1, 0xfc, 0xfc, 0xeb, 0xdf, 0xfe, 0x58, 0x30, 0x9e, 0xff, 0xf2, 
0xd3, 0xb7, 0x23, 0x6b,
-       0xcc, 0x40, 0x2b, 0x50, 0xe8, 0x06, 0xf8, 0x84, 0xb0, 0x61, 0x28, 0x5a, 
0x96, 0x93, 0x9b, 0xa8,
-       0x2e, 0x64, 0x42, 0x51, 0x14, 0xb5, 0x3b, 0xf2, 0x71, 0x93, 0xb9, 0xd8, 
0x58, 0x90, 0xdb, 0xa5,
-       0x7c, 0x22, 0x8b, 0xb0, 0x93, 0x8a, 0xf2, 0x92, 0xa2, 0xba, 0x50, 0x1d, 
0x6e, 0xa6, 0xce, 0x38,
-       0x4e, 0xb7, 0x28, 0xb9, 0xb3, 0x41, 0x54, 0x85, 0x4a, 0x0a, 0x48, 0x36, 
0xb8, 0x22, 0x83, 0x66,
-       0x62, 0x68, 0x0d, 0xae, 0xa5, 0xfc, 0x9d, 0x3d, 0x43, 0x97, 0x4d, 0x9e, 
0x76, 0xa3, 0x07, 0x00,
-       0x16, 0x76, 0x88, 0x4f, 0xc4, 0xf4, 0x0c, 0x58, 0xc9, 0xae, 0x15, 0xaa, 
0x15, 0x65, 0x9e, 0x63,
-       0x30, 0x52, 0xda, 0x51, 0xc5, 0x52, 0xf8, 0xe6, 0x8f, 0x1a, 0xe8, 0x63, 
0x53, 0x9d, 0x87, 0x96,
-       0x9e, 0xc7, 0x3a, 0x64, 0x5f, 0x52, 0x8c, 0x82, 0x17, 0x97, 0x6f, 0xfb, 
0xe1, 0x70, 0x60, 0x73,
-       0xec, 0x3e, 0xc4, 0x89, 0x46, 0xa6, 0xdd, 0xe8, 0x2e, 0x40, 0x93, 0xf8, 
0x47, 0x38, 0xd8, 0xc5,
-       0xcf, 0xb8, 0x9c, 0x5c, 0xd1, 0x52, 0x3c, 0xa8, 0x04, 0x99, 0xce, 0x9e, 
0x1c, 0x57, 0xd1, 0xca,
-       0x74, 0xf6, 0xcc, 0x3f, 0x35, 0x80, 0x4e, 0xab, 0x15, 0x1f, 0x0f, 0xdd, 
0x87, 0xdb, 0xef, 0x0e,
-       0xf9, 0x11, 0xa6, 0x9c, 0x38, 0x36, 0x27, 0x8c, 0x5a, 0xf8, 0x10, 0x07, 
0x98, 0x3a, 0x38, 0x96,
-       0xda, 0x3c, 0x18, 0x6d, 0xc3, 0xad, 0x06, 0xa6, 0xf8, 0x90, 0x38, 0xc4, 
0x0e, 0x46, 0xed, 0x66,
-       0x77, 0x78, 0x30, 0x20, 0x8e, 0xa8, 0x34, 0x92, 0xfa, 0x1c, 0x54, 0x88, 
0xbf, 0x47, 0x8e, 0xf1,
-       0x84, 0x1e, 0x8b, 0x3f, 0xe5, 0x94, 0x7a, 0xfb, 0xb0, 0x37, 0x21, 0x45, 
0x07, 0x4b, 0xf9, 0xd0,
-       0x06, 0xe8, 0x42, 0xbd, 0x21, 0xb7, 0x3d, 0x5f, 0x9e, 0x70, 0x96, 0xc8, 
0x27, 0x14, 0xf3, 0xbb,
-       0x3c, 0x5c, 0xfd, 0x24, 0x70, 0x71, 0x30, 0x3e, 0x3d, 0x82, 0x9c, 0x50, 
0x59, 0x7c, 0x54, 0xb9,
-       0x46, 0x9f, 0xc1, 0x35, 0xa5, 0x72, 0x09, 0x8b, 0x03, 0x95, 0xaa, 0xeb, 
0x8a, 0x28, 0x52, 0x69,
-       0x22, 0x6b, 0x2a, 0xc8, 0x9a, 0xce, 0x82, 0x5e, 0x83, 0x5c, 0x93, 0x11, 
0x1a, 0x5f, 0x47, 0x74,
-       0x7e, 0xb6, 0x5c, 0x2a, 0xff, 0x95, 0xfc, 0x34, 0xe3, 0xf7, 0x45, 0x4b, 
0xe2, 0xe8, 0x1d, 0x28,
-       0x76, 0x03, 0x42, 0x1d, 0xe2, 0xdb, 0x83, 0xf1, 0x6d, 0x7c, 0xb1, 0x66, 
0x52, 0x01, 0xa8, 0x09,
-       0x25, 0x65, 0x6f, 0x91, 0x62, 0xe1, 0xe2, 0x14, 0x53, 0x21, 0xe2, 0xa5, 
0x9d, 0x48, 0x21, 0x2f,
-       0xe3, 0xa5, 0xfe, 0x3f, 0xd7, 0xac, 0x09, 0x90, 0x1e, 0xc1, 0xe2, 0x85, 
0x23, 0x40, 0xf7, 0x00,
-       0x64, 0xb3, 0xba, 0x76, 0xc0, 0xab, 0xf2, 0x02, 0x17, 0xaa, 0x37, 0xa7, 
0xfb, 0x2a, 0x41, 0x4b,
-       0x21, 0xa6, 0xc2, 0x6a, 0xf2, 0x22, 0xcf, 0x09, 0xab, 0x29, 0x61, 0xb5, 
0x54, 0x58, 0xdd, 0x80,
-       0xf9, 0x61, 0x75, 0x25, 0xac, 0x8e, 0xda, 0xa0, 0xb7, 0x9f, 0x71, 0x4c, 
0xe5, 0x3d, 0x2e, 0xc8,
-       0x07, 0xe1, 0xf5, 0xb9, 0xb3, 0x1f, 0x33, 0xdb, 0x94, 0x07, 0x23, 0x6b, 
0x12, 0xb9, 0xf4, 0x00,
-       0x4a, 0x69, 0x10, 0x95, 0x21, 0x7b, 0x8c, 0x47, 0xb1, 0xda, 0xc4, 0x12, 
0x55, 0x60, 0xe1, 0xc4,
-       0x1e, 0x0c, 0x23, 0x89, 0xe9, 0x56, 0x64, 0xec, 0x64, 0xee, 0x6b, 0x26, 
0x81, 0xca, 0x2c, 0x59,
-       0xa1, 0x6b, 0x50, 0x78, 0x44, 0x43, 0x1f, 0x3b, 0xe4, 0x90, 0x60, 0xb7, 
0xfc, 0x0a, 0xba, 0x0b,
-       0x4b, 0x0a, 0x67, 0xff, 0x21, 0x65, 0xa7, 0x74, 0xdf, 0xe6, 0xfb, 0x21, 
0xb7, 0x03, 0x5e, 0xd6,
-       0xd0, 0x0a, 0xdc, 0x51, 0xf1, 0x47, 0xf4, 0x38, 0x61, 0xf4, 0x24, 0x23, 
0x63, 0xfe, 0x9c, 0x51,
-       0xa7, 0x82, 0xde, 0x82, 0x1b, 0x4d, 0xe6, 0x79, 0x84, 0x8b, 0xf3, 0x4d, 
0x6e, 0x60, 0x54, 0xf5,
-       0x2c, 0x08, 0xbd, 0x0f, 0xe5, 0xe4, 0xbf, 0x42, 0xe6, 0x79, 0xc9, 0x97, 
0xee, 0x1f, 0x41, 0x69,
-       0x39, 0x65, 0x2f, 0x96, 0x53, 0x43, 0x9d, 0x54, 0x4e, 0x4e, 0x6a, 0x75, 
0xa6, 0x9a, 0x2e, 0x6d,
-       0x4c, 0xbf, 0xaa, 0xbd, 0xab, 0x89, 0xd7, 0xd8, 0xc2, 0x2e, 0xf6, 0x7c, 
0x9e, 0xfc, 0x07, 0xe8,
-       0x96, 0xe2, 0xf9, 0xef, 0x3a, 0xb5, 0x03, 0x86, 0xfa, 0xbe, 0x26, 0xff, 
0x69, 0x2d, 0x9b, 0xdb,
-       0xf1, 0x83, 0x3a, 0x17, 0x4f, 0x77, 0x39, 0xf7, 0x2f, 0xbb, 0xbc, 0x30, 
0xbf, 0xcb, 0xb5, 0x4b,
-       0xeb, 0xf2, 0xf7, 0x6a, 0x97, 0xeb, 0xe2, 0x73, 0xa8, 0x87, 0x9d, 0x00, 
0xf3, 0xe4, 0x73, 0x28,
-       0xb2, 0xfe, 0xff, 0x3a, 0xac, 0x5f, 0x5a, 0x87, 0xb6, 0x21, 0xdf, 0x65, 
0x03, 0xe2, 0x8c, 0x5e,
-       0xf0, 0x0d, 0x82, 0x20, 0xf7, 0xb1, 0xed, 0x25, 0xc1, 0x72, 0x6d, 0x6e, 
0xc1, 0xf5, 0xee, 0xc0,
-       0x26, 0x74, 0x17, 0x87, 0x3c, 0xfe, 0xd2, 0xdd, 0x42, 0x77, 0x40, 0x17, 
0x20, 0xc7, 0x21, 0xdf,
-       0x8a, 0xb7, 0x9f, 0x38, 0xcc, 0x1a, 0xdc, 0x88, 0xf5, 0x34, 0x2f, 0xa8, 
0x3a, 0x1d, 0x54, 0x35,
-       0xd7, 0xa0, 0xd8, 0x23, 0x9e, 0x3f, 0xc0, 0x3d, 0x1e, 0x10, 0xda, 0x17, 
0x55, 0x36, 0x19, 0xe5,
-       0x98, 0x26, 0x33, 0x4c, 0xcc, 0x83, 0xbc, 0xfc, 0xf8, 0xaf, 0xfd, 0x1d, 
0x00, 0x00, 0xff, 0xff,
-       0x9a, 0xa9, 0xa8, 0xbc, 0x7c, 0x0c, 0x00, 0x00,
+       // 1160 bytes of a gzipped FileDescriptorProto
+       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 
0xcd, 0x6f, 0x1b, 0x45,
+       0x14, 0xc7, 0x1f, 0x71, 0xea, 0x67, 0xd7, 0x75, 0xa6, 0x4e, 0x62, 0x99, 
0xa8, 0x89, 0x56, 0x11,
+       0x0a, 0x12, 0x71, 0x88, 0xed, 0x44, 0x25, 0xaa, 0x84, 0xb0, 0x1d, 0xc0, 
0x94, 0x0f, 0x33, 0x4e,
+       0x03, 0x52, 0x95, 0x46, 0x9b, 0xdd, 0x89, 0x33, 0x8a, 0x3d, 0xb3, 0xec, 
0x8e, 0x93, 0x5a, 0xc0,
+       0x99, 0x03, 0x47, 0xfe, 0x00, 0x24, 0xa4, 0x5e, 0x39, 0x22, 0x71, 0xe7, 
0xff, 0x88, 0x14, 0x24,
+       0x10, 0x57, 0x4e, 0xdc, 0x40, 0x33, 0xbb, 0xeb, 0xdd, 0x75, 0xec, 0xa4, 
0x15, 0x54, 0x22, 0xa7,
+       0x79, 0x1f, 0xbf, 0xf7, 0xde, 0xbc, 0xf7, 0x7b, 0x9e, 0x0d, 0x80, 0xc9, 
0x0d, 0xa7, 0x6c, 0xd9,
+       0x5c, 0x70, 0x94, 0x36, 0xb9, 0x31, 0xe8, 0x13, 0x26, 0x9c, 0xd2, 0x76, 
0x97, 0x8a, 0x93, 0xc1,
+       0x51, 0xd9, 0xe0, 0xfd, 0x8d, 0xfe, 0x39, 0x15, 0xa7, 0xfc, 0x7c, 0xa3, 
0xcb, 0xd7, 0x95, 0xdf,
+       0xfa, 0x99, 0xde, 0xa3, 0xa6, 0x2e, 0xb8, 0xed, 0x6c, 0x8c, 0x8e, 0x6e, 
0x88, 0xd2, 0x7a, 0x08,
+       0xd7, 0xe5, 0x5d, 0xbe, 0xa1, 0xd4, 0x47, 0x83, 0x63, 0x25, 0x29, 0x41, 
0x9d, 0x5c, 0x77, 0xed,
+       0xdb, 0x18, 0xe4, 0x3a, 0xb4, 0xcb, 0x88, 0xb9, 0xcb, 0xce, 0x48, 0x8f, 
0x5b, 0x04, 0xad, 0x42,
+       0x5a, 0x6a, 0x74, 0x31, 0xb0, 0x49, 0x31, 0xb6, 0x12, 0x5b, 0xcb, 0xd6, 
0x53, 0x97, 0x17, 0xcb,
+       0x71, 0xab, 0x80, 0x03, 0x03, 0x7a, 0xcb, 0xf5, 0x22, 0x76, 0xa3, 0xd5, 
0x2c, 0xc6, 0x57, 0x62,
+       0x6b, 0xe9, 0xfa, 0xab, 0x97, 0x17, 0xcb, 0x8b, 0x30, 0xff, 0xe4, 0xd3, 
0xc7, 0x8f, 0x77, 0xf4,
+       0x1e, 0x1b, 0xf4, 0x77, 0x0e, 0x0e, 0xbe, 0xac, 0x6d, 0x7d, 0xbd, 0xfa, 
0xd5, 0x93, 0x55, 0x1c,
+       0x78, 0xa3, 0x22, 0xcc, 0x7e, 0x44, 0x1c, 0x47, 0xef, 0x92, 0x62, 0x42, 
0x86, 0xc7, 0xbe, 0xa8,
+       0x71, 0xb8, 0x35, 0x2a, 0xe3, 0x75, 0x48, 0xbd, 0x4f, 0x74, 0x93, 0xd8, 
0xaa, 0x86, 0x4c, 0x65,
+       0xae, 0x3c, 0x6a, 0x4e, 0xd9, 0x35, 0x60, 0xcf, 0x01, 0x21, 0x48, 0xd6, 
0xb9, 0x39, 0x54, 0x65,
+       0x64, 0xb1, 0x3a, 0xa3, 0x55, 0xb8, 0xbd, 0xcb, 0x0c, 0x7b, 0x68, 0x09, 
0x62, 0x2a, 0xa3, 0x9b,
+       0x2a, 0xaa, 0xd4, 0x7e, 0x48, 0xf8, 0x59, 0xd0, 0x02, 0xa4, 0x5a, 0xed, 
0x77, 0x3b, 0xad, 0xa6,
+       0xca, 0x97, 0xc6, 0x9e, 0x24, 0xab, 0xdd, 0x27, 0xb6, 0x43, 0x39, 0x53, 
0xf1, 0xe3, 0xd8, 0x17,
+       0xd1, 0x1b, 0x70, 0xab, 0xa9, 0x0b, 0xb2, 0x47, 0xfb, 0xee, 0x45, 0x12, 
0xf5, 0xfc, 0xe5, 0xc5,
+       0x72, 0x36, 0xff, 0xec, 0x9b, 0xdf, 0xfe, 0x98, 0x29, 0x3e, 0xfb, 0xe5, 
0xa7, 0xef, 0x86, 0x78,
+       0xe4, 0x81, 0x56, 0x20, 0xd3, 0xb6, 0xc9, 0x19, 0xe5, 0x03, 0x47, 0xb6, 
0x2c, 0xa9, 0x92, 0x84,
+       0x55, 0x48, 0x83, 0xac, 0x2c, 0x6a, 0x6f, 0x68, 0x91, 0x06, 0x37, 0x49, 
0x71, 0x46, 0xa5, 0x8b,
+       0xe8, 0x64, 0x14, 0x29, 0xfb, 0x15, 0xa5, 0x94, 0x4b, 0x58, 0x85, 0x6a, 
0x30, 0x1f, 0xb9, 0xe3,
+       0x28, 0xdc, 0xac, 0xf2, 0x9d, 0x6c, 0x44, 0x15, 0x28, 0x44, 0x0c, 0x7e, 
0x82, 0x5b, 0x0a, 0x34,
+       0xd1, 0x86, 0xd6, 0xe0, 0x4e, 0x44, 0xdf, 0xda, 0x2f, 0xa6, 0x55, 0x93, 
0xc7, 0xd5, 0xe8, 0x01,
+       0x00, 0x26, 0x06, 0xb5, 0xa8, 0x9c, 0x5e, 0x11, 0x56, 0x12, 0x6b, 0x99, 
0x4a, 0x21, 0x34, 0xcf,
+       0x91, 0xd1, 0x65, 0xda, 0x49, 0x01, 0x87, 0xfc, 0xb5, 0x1f, 0x63, 0x90, 
0x1e, 0x89, 0xe1, 0x79,
+       0xc4, 0xa2, 0xf3, 0x58, 0x87, 0xc4, 0x73, 0x92, 0x51, 0xfa, 0x79, 0xe5, 
0xeb, 0x96, 0x33, 0xe8,
+       0xe9, 0x82, 0x98, 0x0f, 0x89, 0xcf, 0x91, 0x71, 0x35, 0xba, 0x07, 0xd0, 
0xa0, 0xd6, 0x09, 0xb1,
+       0xf7, 0xc8, 0x53, 0xa1, 0x26, 0x97, 0xc5, 0x21, 0x0d, 0xca, 0x41, 0xbc, 
0xb5, 0xaf, 0xc6, 0x95,
+       0xc5, 0xf1, 0xd6, 0xbe, 0xf6, 0x57, 0x0c, 0xa0, 0xd5, 0x6c, 0x7a, 0xd7, 
0x43, 0xf7, 0x61, 0xf1,
+       0x9d, 0x81, 0x38, 0x21, 0x4c, 0x50, 0x43, 0x17, 0x94, 0x33, 0x4c, 0x8e, 
0x89, 0x4d, 0x98, 0x41,
+       0x3c, 0xaa, 0x4d, 0x33, 0xa3, 0x6d, 0x58, 0xa8, 0x13, 0x46, 0x8e, 0xa9, 
0x41, 0x75, 0x7b, 0xb8,
+       0xdb, 0x68, 0x0f, 0x8e, 0x7a, 0xd4, 0x90, 0x95, 0xba, 0x54, 0x9f, 0x62, 
0x95, 0xe4, 0xef, 0xd0,
+       0x53, 0x12, 0xb8, 0x7b, 0xe4, 0x8f, 0x28, 0x15, 0xdf, 0x3e, 0xec, 0x04, 
0x4e, 0xee, 0xc5, 0x22,
+       0x3a, 0x54, 0x86, 0xb4, 0x64, 0xaf, 0x23, 0xf4, 0xbe, 0xa5, 0x6e, 0x38, 
0x89, 0xe4, 0x81, 0x8b,
+       0xf6, 0xe7, 0x2c, 0xdc, 0xfe, 0xc4, 0x36, 0x89, 0x3d, 0xba, 0x3d, 0x82, 
0xa4, 0x64, 0x99, 0x77,
+       0x55, 0x75, 0x46, 0x9f, 0xc1, 0x9d, 0x50, 0xe5, 0xca, 0x2c, 0x2f, 0x94, 
0xab, 0xac, 0x87, 0x48,
+       0x11, 0x09, 0xe3, 0x4a, 0x63, 0x20, 0x3c, 0x1e, 0x05, 0xbd, 0x06, 0xc9, 
0x06, 0xa7, 0xcc, 0x5b,
+       0x47, 0x74, 0x79, 0xb1, 0x9c, 0xcb, 0xff, 0xed, 0xff, 0xc5, 0x8a, 0xbf, 
0xcf, 0x62, 0x65, 0x47,
+       0x6f, 0x43, 0xb6, 0x6d, 0x53, 0x66, 0x50, 0x4b, 0xef, 0x8d, 0xb6, 0xf1, 
0x7a, 0xce, 0x44, 0x00,
+       0xa8, 0x01, 0xb9, 0x50, 0x6e, 0x19, 0x62, 0xe6, 0xe6, 0x10, 0x63, 0x10, 
0xf9, 0x4b, 0x1b, 0x50,
+       0x21, 0xa5, 0xf0, 0x8a, 0xff, 0x9f, 0xc7, 0x70, 0x60, 0x88, 0x8e, 0x60, 
0xf6, 0xc6, 0x11, 0xa0,
+       0x2d, 0x00, 0xd5, 0xac, 0xb6, 0x6e, 0x8b, 0x8a, 0x5a, 0xe0, 0x4c, 0x65, 
0x7e, 0xbc, 0xaf, 0xca,
+       0x88, 0x43, 0x8e, 0x11, 0x58, 0x55, 0x2d, 0xf2, 0x14, 0x58, 0x35, 0x04, 
0xab, 0x46, 0x60, 0xb5,
+       0x22, 0x4c, 0x87, 0xd5, 0x42, 0xb0, 0x1a, 0x3a, 0x80, 0x39, 0x25, 0x61, 
0xf2, 0xc5, 0xee, 0x53,
+       0x41, 0x98, 0xda, 0xe7, 0x8c, 0xfa, 0x61, 0xd8, 0xb8, 0x9e, 0x03, 0x61, 
0xc4, 0x2e, 0x13, 0xf6,
+       0x10, 0x5f, 0x8d, 0x84, 0x38, 0x2c, 0x2a, 0x65, 0x87, 0x18, 0x36, 0x11, 
0x91, 0x24, 0x59, 0x95,
+       0x64, 0xeb, 0xfa, 0x24, 0x57, 0x71, 0x6e, 0xaa, 0x69, 0x51, 0x4b, 0x4d, 
0x58, 0x98, 0x5c, 0x1d,
+       0xca, 0x43, 0xe2, 0x94, 0x0c, 0x3d, 0xfa, 0xcb, 0x23, 0x2a, 0xc0, 0xcc, 
0x99, 0xde, 0x1b, 0xb8,
+       0x9c, 0x4f, 0x63, 0x57, 0xd8, 0x89, 0xdf, 0x8f, 0x95, 0x3e, 0x80, 0xa5, 
0xeb, 0xd2, 0xbf, 0x48,
+       0x2c, 0x8d, 0x42, 0x61, 0xd2, 0xce, 0xa0, 0x3b, 0x90, 0x79, 0xc4, 0x1c, 
0x8b, 0x18, 0xf4, 0x98,
+       0x12, 0x33, 0xff, 0x0a, 0xba, 0x07, 0xa5, 0x90, 0xcf, 0xe1, 0x43, 0xc6, 
0xcf, 0xd9, 0xa1, 0x2e,
+       0x0e, 0x1d, 0xa1, 0xdb, 0x22, 0x1f, 0x43, 0x2b, 0xb0, 0x14, 0xb6, 0x3f, 
0x62, 0xa7, 0xbe, 0x47,
+       0x47, 0x79, 0xc4, 0xb5, 0x9f, 0xe3, 0x61, 0xca, 0xa1, 0x37, 0xe1, 0x6e, 
0x83, 0xf7, 0xfb, 0x54,
+       0xc8, 0x7e, 0x06, 0x3f, 0x2f, 0x6e, 0xd5, 0x93, 0x4c, 0xe8, 0x3d, 0xc8, 
0xfb, 0x0f, 0xa1, 0x8a,
+       0xf3, 0x9c, 0x3f, 0xe3, 0x57, 0x40, 0xd1, 0x5d, 0x49, 0xdc, 0xbc, 0x2b, 
0x75, 0x48, 0x07, 0xcc,
+       0x48, 0x2a, 0x66, 0xac, 0x4e, 0x5c, 0x95, 0xf2, 0x18, 0x11, 0x02, 0x58, 
0xe9, 0x01, 0xe4, 0xfe,
+       0xc5, 0x98, 0x7e, 0x0d, 0xf7, 0xae, 0x2a, 0x9f, 0x1a, 0x4c, 0x4c, 0xd2, 
0xb7, 0x84, 0xff, 0xc0,
+       0xa5, 0x71, 0x48, 0xf3, 0xdf, 0x75, 0x6a, 0x07, 0x8a, 0xe1, 0xc7, 0xc3, 
0x7f, 0xb0, 0x9b, 0xba,
+       0xd0, 0xbd, 0xd7, 0x62, 0xaa, 0x3d, 0xda, 0xe5, 0xe4, 0x0b, 0x76, 0x79, 
0x66, 0x7a, 0x97, 0xab,
+       0x2f, 0xad, 0xcb, 0xdf, 0x87, 0xbb, 0x5c, 0x93, 0xdf, 0x7a, 0xee, 0x8a, 
0xf9, 0xdf, 0x7a, 0xae,
+       0xf4, 0xff, 0xe7, 0x61, 0xed, 0xa5, 0x75, 0x68, 0x1b, 0x52, 0x6d, 0xde, 
0xa3, 0xc6, 0xf0, 0x9a,
+       0x0f, 0x2c, 0x04, 0xc9, 0x8f, 0xf5, 0xbe, 0x0f, 0x56, 0x67, 0x6d, 0x13, 
0xe6, 0xda, 0x3d, 0x9d,
+       0xb2, 0x3d, 0xe2, 0x08, 0xef, 0x33, 0x7e, 0x13, 0x2d, 0x41, 0x5a, 0x1a, 
0x05, 0x71, 0xc4, 0xa6,
+       0x97, 0x3e, 0x50, 0x68, 0x55, 0xb8, 0xeb, 0xf1, 0x69, 0x1a, 0xa8, 0x32, 
0x0e, 0xaa, 0x68, 0x6b,
+       0x90, 0xed, 0xd0, 0xbe, 0xd5, 0x23, 0x1d, 0x61, 0x53, 0xd6, 0x95, 0x55, 
0x36, 0x38, 0x13, 0x84,
+       0xf9, 0x33, 0xf4, 0xc5, 0xa3, 0x94, 0xfa, 0xcf, 0xa6, 0xfa, 0x4f, 0x00, 
0x00, 0x00, 0xff, 0xff,
+       0x17, 0x99, 0x7b, 0x18, 0x59, 0x0d, 0x00, 0x00,
 }
diff --git a/libs/documents/docs.proto b/libs/documents/docs.proto
index cc71745..62b25a8 100644
--- a/libs/documents/docs.proto
+++ b/libs/documents/docs.proto
@@ -91,9 +91,11 @@ message OrderDocument {
     OrderPart2 OrderPart2    = 8;
     OrderPart3 OrderPart3    = 9;
     OrderPart4 OrderPart4    = 10;
-    map<string, string> Extension = 11;
+    map<string, string> OrderReqExtension = 11;
+    map<string, string> OrderSecretReqExtension = 12;
 }
 
+
 message OrderPart2 {
     string CommitmentPublicKey = 1;
     string PreviousOrderCID    = 2 [(validator.field) = {regex: 
"^Q[[:alnum:]]{45}$|^$"}];
diff --git a/libs/documents/docs.validator.pb.go 
b/libs/documents/docs.validator.pb.go
index 09aea38..2772f39 100644
--- a/libs/documents/docs.validator.pb.go
+++ b/libs/documents/docs.validator.pb.go
@@ -116,6 +116,7 @@ func (this *OrderDocument) Validate() error {
                }
        }
        // Validation of proto3 map<> fields is unsupported.
+       // Validation of proto3 map<> fields is unsupported.
        return nil
 }
 
diff --git a/pkg/config/config.go b/pkg/config/config.go
index d3a1386..566c89c 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -74,6 +74,11 @@ type NodeConfig struct {
        Datastore             string `yaml:"dataStore"`
 }
 
+//Blockchain Config -
+type BlockchainConfig struct {
+       BroadcastNode string `yaml:"broadcastNode"`
+}
+
 // PluginsConfig -
 type PluginsConfig struct {
        Service string `yaml:"service"`
@@ -81,11 +86,12 @@ type PluginsConfig struct {
 
 // Config -
 type Config struct {
-       HTTP    HTTPConfig    `yaml:"http"`
-       Node    NodeConfig    `yaml:"node"`
-       Log     LogConfig     `yaml:"log"`
-       IPFS    IPFSConfig    `yaml:"ipfs"`
-       Plugins PluginsConfig `yaml:"plugins"`
+       HTTP       HTTPConfig       `yaml:"http"`
+       Node       NodeConfig       `yaml:"node"`
+       Log        LogConfig        `yaml:"log"`
+       IPFS       IPFSConfig       `yaml:"ipfs"`
+       Plugins    PluginsConfig    `yaml:"plugins"`
+       Blockchain BlockchainConfig `yaml:"blockchain"`
 }
 
 // Init initialise config folder with default options
diff --git a/pkg/config/default.go b/pkg/config/default.go
index 1ea3ba1..79ebd20 100644
--- a/pkg/config/default.go
+++ b/pkg/config/default.go
@@ -20,11 +20,12 @@ package config
 // DefaultConfig -
 func DefaultConfig() *Config {
        return &Config{
-               HTTP:    defaultHTTPConfig(),
-               Node:    defaultNodeConfig(),
-               Log:     defaultLogConfig(),
-               IPFS:    defaultIPFSConfig(),
-               Plugins: defaultPluginsConfig(),
+               HTTP:       defaultHTTPConfig(),
+               Node:       defaultNodeConfig(),
+               Log:        defaultLogConfig(),
+               IPFS:       defaultIPFSConfig(),
+               Plugins:    defaultPluginsConfig(),
+               Blockchain: defaultBlockchainConfig(),
        }
 }
 
@@ -70,6 +71,12 @@ func defaultNodeConfig() NodeConfig {
        }
 }
 
+func defaultBlockchainConfig() BlockchainConfig {
+       return BlockchainConfig{
+               BroadcastNode: "34.246.173.153:26657",
+       }
+}
+
 // PluginsConfig -
 func defaultPluginsConfig() PluginsConfig {
        return PluginsConfig{
diff --git a/pkg/defaultservice/order.go b/pkg/defaultservice/order.go
index ac8a60f..7adfbc9 100644
--- a/pkg/defaultservice/order.go
+++ b/pkg/defaultservice/order.go
@@ -105,7 +105,9 @@ func (s *Service) PrepareOrderPart1(order 
*documents.OrderDoc, reqExtension map[
 }
 
 // PrepareOrderResponse gets the updated order and returns the commitment and 
extension
-func (s *Service) PrepareOrderResponse(orderPart2 *documents.OrderDoc, 
reqExtension, fulfillExtension map[string]string) (commitment string, extension 
map[string]string, err error) {
+//func (s *Service) PrepareOrderResponse(orderPart2 *documents.OrderDoc, 
reqExtension, fulfillExtension map[string]string) (commitment string, extension 
map[string]string, err error) {
+
+func (s *Service) PrepareOrderResponse(orderPart2 *documents.OrderDoc) 
(commitment string, extension map[string]string, err error) {
        return orderPart2.OrderPart2.CommitmentPublicKey, nil, nil
 }
 
@@ -142,10 +144,13 @@ func (s *Service) Order1(req *api.OrderRequest) (string, 
error) {
                return "", err
        }
 
-       // fulfillExtension, err := s.Plugin.PrepareOrderPart1(order, 
req.Extension)
-       // if err != nil {
-       //      return "", err
-       // }
+       //Populate extension fields
+       if order.OrderReqExtension == nil {
+               order.OrderReqExtension = make(map[string]string)
+       }
+       for key, value := range req.Extension {
+               order.OrderReqExtension[key] = value
+       }
 
        //This is serialized and output to the chain
        txHash, payload, err := common.CreateTX(nodeID, s.Store, nodeID, order, 
recipientList)
@@ -208,6 +213,14 @@ func (s *Service) OrderSecret1(req 
*api.OrderSecretRequest) (string, error) {
                }
        }
 
+       //Populate extension fields
+       if order.OrderSecretReqExtension == nil {
+               order.OrderSecretReqExtension = make(map[string]string)
+       }
+       for key, value := range req.Extension {
+               order.OrderSecretReqExtension[key] = value
+       }
+
        if err := s.Plugin.ValidateOrderSecretRequest(req, *order); err != nil {
                return "", err
        }
diff --git a/pkg/safeguardsecret/service.go b/pkg/safeguardsecret/service.go
index 43f3e09..12e40cf 100644
--- a/pkg/safeguardsecret/service.go
+++ b/pkg/safeguardsecret/service.go
@@ -21,6 +21,10 @@ Package safeguardsecret - is an example of a D-TA plugin
 package safeguardsecret
 
 import (
+       "errors"
+       "fmt"
+       "strings"
+
        "github.com/apache/incubator-milagro-dta/libs/crypto"
        "github.com/apache/incubator-milagro-dta/libs/cryptowallet"
        "github.com/apache/incubator-milagro-dta/libs/documents"
@@ -56,10 +60,12 @@ func (s *Service) Vendor() string {
 // PrepareOrderResponse gets the updated order and returns the commitment and 
extension
 func (s *Service) PrepareOrderResponse(order *documents.OrderDoc) (commitment 
string, extension map[string]string, err error) {
        finalPublicKey := order.OrderPart2.CommitmentPublicKey
-       plainText := order.OrderPart2.Extension["plainText"]
+       plainText := order.OrderReqExtension["plainText"]
+       delete(order.OrderReqExtension, "plainText") //we don't want to store 
this
        c, v, t, err := crypto.Secp256k1Encrypt(plainText, finalPublicKey)
-
-       return finalPublicKey, map[string]string{"cypherText": c, "v": v, "t": 
t}, nil
+       cypherTextWithParams := fmt.Sprintf("%s:%s:%s", t, v, c)
+       return finalPublicKey, map[string]string{"cypherText": 
cypherTextWithParams}, nil
+       //      return finalPublicKey, map[string]string{"cypherText": c, "v": 
v, "t": t}, nil
 }
 
 // ProduceFinalSecret -
@@ -70,13 +76,14 @@ func (s *Service) ProduceFinalSecret(seed, sikeSK []byte, 
order, orderPart4 *doc
        if err != nil {
                return "", "", nil, err
        }
-
-       //HACKED TO MAKE WORKD NEED TO PASS EXTENDION CSM TODO
-       plainText, err := crypto.Secp256k1Decrypt("1", "1", "1", 
finalPrivateKey)
-       //plainText, err := 
crypto.Secp256k1Decrypt(req.Extension["cypherText"], req.Extension["v"], 
req.Extension["t"], finalPrivateKey)
+       cypherTextWithParams := order.OrderPart2.Extension["cypherText"]
+       cypherparts := strings.SplitN(cypherTextWithParams, ":", 3) //maps 
parts to t:v:c
+       if len(cypherparts) != 3 {
+               return "", "", nil, errors.New("Invalid CypherText")
+       }
+       plainText, err := crypto.Secp256k1Decrypt(cypherparts[2], 
cypherparts[1], cypherparts[0], finalPrivateKey)
        if err != nil {
                return "", "", nil, err
        }
-
        return finalPrivateKey, finalPublicKey, map[string]string{"plainText": 
plainText}, nil
 }
diff --git a/pkg/tendermint/tendermint.go b/pkg/tendermint/tendermint.go
index 1ea19f6..e02b3c1 100644
--- a/pkg/tendermint/tendermint.go
+++ b/pkg/tendermint/tendermint.go
@@ -9,7 +9,6 @@ import (
        "errors"
        "fmt"
        "net/http"
-       "os"
        "strings"
 
        "github.com/apache/incubator-milagro-dta/pkg/api"
@@ -115,56 +114,22 @@ func decodeTX(payload string) (*api.BlockChainTX, string, 
error) {
 }
 
 func callNextTX(svc service.Service, tx *api.BlockChainTX, listenPort string) 
error {
-       payloadString := string(tx.Payload)
-
-       if tx.Processor == "NONE" {
-               //The TX is information and doesn't require any further 
processing
+       switch tx.Processor {
+       case "none":
                return nil
-       }
-
-       if tx.Processor == "dump" {
+       case "dump":
                svc.Dump(tx)
-               return nil
-       }
-       if tx.Processor == "v1/fulfill/order" {
+       case "v1/fulfill/order":
                svc.FulfillOrder(tx)
-               return nil
-       }
-       if tx.Processor == "v1/order2" {
+       case "v1/order2":
                svc.Order2(tx)
-               return nil
-       }
-
-       if tx.Processor == "v1/fulfill/order/secret" {
+       case "v1/fulfill/order/secret":
                svc.FulfillOrderSecret(tx)
-               return nil
-       }
-       if tx.Processor == "v1/order/secret2" {
+       case "v1/order/secret2":
                svc.OrderSecret2(tx)
-               return nil
-       }
-
-       desintationURL := fmt.Sprintf("http://localhost"+listenPort+"/%s";, 
tx.Processor)
 
-       body := strings.NewReader(payloadString)
-       req, err := http.NewRequest("POST", os.ExpandEnv(desintationURL), body)
-       if err != nil {
-               return err
-       }
-       req.Header.Set("Accept", "*/*")
-       req.Header.Set("Content-Type", "application/json")
-
-       resp, err := http.DefaultClient.Do(req)
-       if err != nil {
-               return err
-       }
-       defer resp.Body.Close()
-       scanner := bufio.NewScanner(resp.Body)
-       scanner.Split(bufio.ScanBytes)
-       t := ""
-       for scanner.Scan() {
-               t += scanner.Text()
-               ///fmt.Print(scanner.Text())
+       default:
+               return errors.New("Unknown processor")
        }
        return nil
 }
diff --git a/pkg/tendermint/websockets.go b/pkg/tendermint/websockets.go
index 7f6c0fc..520de51 100644
--- a/pkg/tendermint/websockets.go
+++ b/pkg/tendermint/websockets.go
@@ -27,8 +27,8 @@ func catchUp(quene chan tmtypes.Tx, store *datastore.Store, 
logger *logger.Logge
 }
 
 //Subscribe to Websocket and add to queue
-func subscribeAndQueue(queueWaiting chan api.BlockChainTX, logger 
*logger.Logger, nodeID string, listenPort string) error {
-       client := tmclient.NewHTTP("tcp://"+node+"", "/websocket")
+func subscribeAndQueue(queueWaiting chan api.BlockChainTX, logger 
*logger.Logger, nodeID string, listenPort string, blockchainNode string) error {
+       client := tmclient.NewHTTP("tcp://"+blockchainNode+"", "/websocket")
        //client.SetLogger(tmlogger)
        err := client.Start()
        if err != nil {
@@ -71,7 +71,7 @@ func subscribeAndQueue(queueWaiting chan api.BlockChainTX, 
logger *logger.Logger
 
                        //Add into the waitingQueue for later processing
                        queueWaiting <- payload
-                       fmt.Printf("Incoming Transaction:%d \n", 
len(queueWaiting))
+                       //fmt.Printf("Incoming Transaction:%d \n", 
len(queueWaiting))
 
                case <-quit:
                        os.Exit(0)
@@ -165,21 +165,14 @@ func parseHistory(txHistory []ctypes.ResultTx) {
 func processTXQueue(svc service.Service, queue chan api.BlockChainTX, 
listenPort string) {
        print("Processing queue\n")
        for payload := range queue {
-               //blockchainTX, txid, err := decodeTX(string(tx))
-               //TXIDhex := hex.EncodeToString(payload.TXhash[:])
-               //      logger.Info("Incoming TXHash:%s . Processor:%s", 
TXIDhex, payload.Processor)
-
                callNextTX(svc, &payload, listenPort)
        }
-       print("Finished processing queue")
 }
 
 //Subscribe - Connect to the Tendermint websocket to collect events
-func Subscribe(svc service.Service, store *datastore.Store, logger 
*logger.Logger, nodeID string, listenPort string) error {
-       //Subscribe to channel
-       //Get height
+func Subscribe(svc service.Service, store *datastore.Store, logger 
*logger.Logger, nodeID string, listenPort string, blockchainNode string) error {
 
-       latestStatus, _ := getChainStatus(node)
+       latestStatus, _ := getChainStatus(blockchainNode)
        currentBlockHeight, err := 
strconv.Atoi(latestStatus.Result.SyncInfo.LatestBlockHeight)
 
        if err != nil {
@@ -194,113 +187,12 @@ func Subscribe(svc service.Service, store 
*datastore.Store, logger *logger.Logge
        queueWaiting := make(chan api.BlockChainTX, 1000)
 
        //while we are processessing the history save all new transactions in a 
queue for later
-
-       go subscribeAndQueue(queueWaiting, logger, nodeID, listenPort)
-
+       go subscribeAndQueue(queueWaiting, logger, nodeID, listenPort, 
blockchainNode)
        loadAllHistoricTX(processedToHeight, currentBlockHeight, txHistory, 
nodeID, listenPort)
-
        processTXQueue(svc, queueWaiting, listenPort)
-
-       // var height int
-       // store.Get("chain", "height", &height)
-
-       // catchUp(queue, store, logger, nodeID, listenPort, height)
-       // return nil
-
-       // client := tmclient.NewHTTP("tcp://"+node+"", "/websocket")
-       // //client.SetLogger(tmlogger)
-       // err := client.Start()
-       // if err != nil {
-       //      logger.Info("Failed to start Tendermint HTTP client %s", err)
-       //      return err
-       // }
-       // defer client.Stop()
-
-       // //curl 
"34.246.173.153:26657/tx_search?query=\"tag.part=4%20AND%20tag.reference='579a2864-e100-11e9-aaf4-acde48001122'\""
-       // query := "tag.recipient='" + nodeID + "'"
-       // //query := "tm.event = 'Tx'"
-
-       // out, err := client.Subscribe(context.Background(), "test", query, 
1000)
-       // if err != nil {
-       //      logger.Info("Failed to subscribe to query %s %s", query, err)
-       //      return err
-       // }
-
-       // logger.Info("Tendermint: Connected")
-
-       // quit := make(chan os.Signal, 1)
-       // signal.Notify(quit, os.Interrupt, syscall.SIGTERM)
-
-       // for {
-       //      select {
-       //      case result := <-out:
-       //              tx := result.Data.(tmtypes.EventDataTx).Tx
-       //              payload := api.BlockChainTX{}
-       //              err := json.Unmarshal(tx, &payload)
-       //              if err != nil {
-       //                      logger.Info("******** Invalid TX - ignored")
-       //                      break
-       //              }
-
-       //              //check if this node is Sender
-       //              if payload.SenderID == nodeID {
-       //                      break
-       //              }
-
-       //              //check is receipient
-       //              isRecipient := false
-       //              for _, v := range payload.RecipientID {
-       //                      if v == nodeID {
-       //                              isRecipient = true
-       //                              break
-       //                      }
-       //              }
-
-       //              if isRecipient == false {
-       //                      logger.Info("******** Invalid Recipient - why 
are we receiving this TX?")
-       //                      break
-       //              }
-
-       //              //blockchainTX, txid, err := decodeTX(string(tx))
-       //              TXIDhex := hex.EncodeToString(payload.TXhash[:])
-       //              logger.Info("Incoming TXHash:%s . Processor:%s", 
TXIDhex, payload.Processor)
-
-       //              if payload.Processor == "NONE" {
-       //                      DumpTX(&payload)
-       //              } else {
-       //                      callNextTX(&payload, listenPort)
-       //              }
-
-       //              //print(blockchainTX)
-       //              // print(txid)
-
-       //              // print(string(xx))
-
-       //              // a := result.Data.(tmtypes.EventDataTx).Index
-       //              // b := result.Data.(tmtypes.EventDataTx)
-       //              // c := b.TxResult
-       //              // tx := c.Tx
-       //              // txdata := []byte(c.Tx)
-       //              // print(string(txdata))
-
-       //              // print(a)
-       //              // Use(c, b, tx)
-
-       //              //logger.Info("got tx","index", 
result.Data.(tmtypes.EventDataTx).Index)
-       //      case <-quit:
-       //              os.Exit(0)
-       //      }
-       // }
        return nil
 }
 
-//Use - helper to remove warnings
-func Use(vals ...interface{}) {
-       for _, val := range vals {
-               _ = val
-       }
-}
-
 func getChainStatus(node string) (status.StatusResponse, error) {
        resp, err := http.Get("http://"; + node + "/status")
        result := status.StatusResponse{}

Reply via email to