func (e *TradingEngine) CancelOrder(oc *OrderCancel) error {
	tokenPair, ok := e.pairs[oc.PairID]
	if !ok {
		return errors.New("Token Pair does not exist")
	}

	ob, ok := e.orderbooks[tokenPair]
	if !ok {
		return errors.New("Orderbook does not exist")
	}

	order, ok := ob.orderIndex[oc.OrderHash]
	if !ok {
		return errors.New("Order does not exist")
	}

	ok, err := oc.VerifySignature(order)
	if err != nil {
		return err
	}

	if !ok {
		return errors.New("Signature is not valid")
	}

	ob.CancelOrder(oc.OrderHash)
	return nil
}
// CancelOrder cancels an order that was previously sent to the orderbook. To be valid,
// the orderCancel struct, need to correspond an existing token pair and order. The
// orderCancel's signature needs to be a valid signature from the order Maker.
CancelOrder cancels an order that was previously sent to the orderbook. To be valid,
the orderCancel struct, need to correspond an existing token pair and order. The
orderCancel's signature needs to be a valid signature from the order Maker.
// CancelOrder cancels an order that was previously sent to the orderbook . To be valid // the orderCancel struct need to correspond an existing token pair and order . The // orderCancel ' s signature needs to be a valid signature from the order Maker .
func (e *TradingEngine) CancelOrder(oc *OrderCancel) error {
	tokenPair, ok := e.pairs[oc.PairID]
	if !ok {
		return errors.New("Token Pair does not exist")
	}
	ob, ok := e.orderbooks[tokenPair]
	if !ok {
		return errors.New("Orderbook does not exist")
	}
	order, ok := ob.orderIndex[oc.OrderHash]
	if !ok {
		return errors.New("Order does not exist")
	}
	ok, err := oc.VerifySignature(order)
	if err != nil {
		return err
	}
	if !ok {
		return errors.New("Signature is not valid")
	}
	ob.CancelOrder(oc.OrderHash)
	return nil
}
func ( e * TradingEngine ) CancelOrder ( oc * OrderCancel ) error { tokenPair , ok := e . pairs [ oc . PairID ] if ! ok { return errors . New ( " " ) } ob , ok := e . orderbooks [ tokenPair ] if ! ok { return errors . New ( " " ) } order , ok := ob . orderIndex [ oc . OrderHash ] if ! ok { return errors . New ( " " ) } ok , err := oc . VerifySignature ( order ) if err != nil { return err } if ! ok { return errors . New ( " " ) } ob . CancelOrder ( oc . OrderHash ) return nil }
CancelOrder cancels an order that was previously sent to the orderbook.
CancelOrder cancels an order that was previously sent to the orderbook .