func (cl *OpencxRPC) GetOrder(args GetOrderArgs, reply *GetOrderReply) (err error) {
	// hash order id.
	sha3 := sha3.New256()
	sha3.Write([]byte(args.OrderID))
	e := sha3.Sum(nil)

	logging.Infof("Checking getorder signature")
	var sigPubKey *koblitz.PublicKey
	if sigPubKey, _, err = koblitz.RecoverCompact(koblitz.S256(), args.Signature, e); err != nil {
		err = fmt.Errorf("Error verifying getorder, invalid signature: \n%s", err)
		return
	}

	cl.Server.LockIngests()
	if reply.Order, err = cl.Server.OpencxDB.GetOrder(args.OrderID); err != nil {
		return
	}
	cl.Server.UnlockIngests()

	// try to parse the order pubkey into koblitz
	var orderPubKey *koblitz.PublicKey
	if orderPubKey, err = koblitz.ParsePubKey(reply.Order.Pubkey[:], koblitz.S256()); err != nil {
		err = fmt.Errorf("Public Key failed parsing check: \n%s", err)
		return
	}

	if !sigPubKey.IsEqual(orderPubKey) {
		err = fmt.Errorf("Pubkey used with signature not equal to the one passed")
		return
	}

	return
}
// GetOrder gets an order based on orderID
GetOrder gets an order based on orderID
// GetOrder gets an order based on orderID
func (cl *OpencxRPC) GetOrder(args GetOrderArgs, reply *GetOrderReply) (err error) {
	sha3 := sha3.New256()
	sha3.Write([]byte(args.OrderID))
	e := sha3.Sum(nil)
	logging.Infof("Checking getorder signature")
	var sigPubKey *koblitz.PublicKey
	if sigPubKey, _, err = koblitz.RecoverCompact(koblitz.S256(), args.Signature, e); err != nil {
		err = fmt.Errorf("Error verifying getorder, invalid signature: \n%s", err)
		return
	}
	cl.Server.LockIngests()
	if reply.Order, err = cl.Server.OpencxDB.GetOrder(args.OrderID); err != nil {
		return
	}
	cl.Server.UnlockIngests()
	var orderPubKey *koblitz.PublicKey
	if orderPubKey, err = koblitz.ParsePubKey(reply.Order.Pubkey[:], koblitz.S256()); err != nil {
		err = fmt.Errorf("Public Key failed parsing check: \n%s", err)
		return
	}
	if !sigPubKey.IsEqual(orderPubKey) {
		err = fmt.Errorf("Pubkey used with signature not equal to the one passed")
		return
	}
	return
}
func ( cl * OpencxRPC ) GetOrder ( args GetOrderArgs , reply * GetOrderReply ) ( err error ) { sha3 := sha3 . New256 ( ) sha3 . Write ( [ ] byte ( args . OrderID ) ) e := sha3 . Sum ( nil ) logging . Infof ( " " ) var sigPubKey * koblitz . PublicKey if sigPubKey , _ , err = koblitz . RecoverCompact ( koblitz . S256 ( ) , args . Signature , e ) ; err != nil { err = fmt . Errorf ( " \n " , err ) return } cl . Server . LockIngests ( ) if reply . Order , err = cl . Server . OpencxDB . GetOrder ( args . OrderID ) ; err != nil { return } cl . Server . UnlockIngests ( ) var orderPubKey * koblitz . PublicKey if orderPubKey , err = koblitz . ParsePubKey ( reply . Order . Pubkey [ : ] , koblitz . S256 ( ) ) ; err != nil { err = fmt . Errorf ( " \n " , err ) return } if ! sigPubKey . IsEqual ( orderPubKey ) { err = fmt . Errorf ( " " ) return } return }
GetOrder gets an order based on orderID
GetOrder gets an order based on orderID
// hash order id. // try to parse the order pubkey into koblitz