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

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

commit 1595b33367ed18d796c50e5c321d7f92a90df7b2
Author: Christopher Morris <[email protected]>
AuthorDate: Fri Oct 11 10:40:11 2019 +0100

    Convert OrderRef to 32Bytes random number
---
 pkg/common/common.go | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/pkg/common/common.go b/pkg/common/common.go
index 52c7d0e..5a50939 100644
--- a/pkg/common/common.go
+++ b/pkg/common/common.go
@@ -26,17 +26,20 @@ import (
        "time"
 
        "github.com/apache/incubator-milagro-dta/pkg/tendermint"
+       "github.com/mr-tron/base58"
 
+       "github.com/apache/incubator-milagro-dta/libs/cryptowallet"
        "github.com/apache/incubator-milagro-dta/libs/datastore"
        "github.com/apache/incubator-milagro-dta/libs/documents"
-       "github.com/google/uuid"
        "github.com/pkg/errors"
 )
 
 // CreateNewDepositOrder - Generate an empty new Deposit Order with random 
reference
 func CreateNewDepositOrder(BeneficiaryIDDocumentCID string, nodeID string, 
orderType string) (*documents.OrderDoc, error) {
        //Create a reference for this order
-       reference, err := uuid.NewUUID()
+       refBytes, err := cryptowallet.RandomBytes(32)
+       reference := base58.Encode(refBytes[:])
+
        if err != nil {
                return nil, err
        }
@@ -51,7 +54,7 @@ func CreateNewDepositOrder(BeneficiaryIDDocumentCID string, 
nodeID string, order
        //oder.Type will be used to extend the things that an order can do.
        order.Type = orderType
        order.PrincipalCID = nodeID
-       order.Reference = reference.String()
+       order.Reference = reference
        order.BeneficiaryCID = BeneficiaryIDDocumentCID
        order.Timestamp = time.Now().Unix()
        return &order, nil

Reply via email to