Skip to content

Commit

Permalink
cp
Browse files Browse the repository at this point in the history
  • Loading branch information
buck54321 committed Jul 28, 2023
1 parent f7fa80b commit 469155a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions dex/testing/loadbot/sidestacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (s *sideStacker) HandleNotification(m *Mantle, note core.Notification) {
case <-ctx.Done():
return
}
s.stack(m)
s.stack(m, n)
}()
maxActiveOrders := 2 * (s.numStanding + s.ordsPerEpoch)
book := m.book()
Expand All @@ -146,10 +146,10 @@ func (s *sideStacker) HandleNotification(m *Mantle, note core.Notification) {
// // log.Infof("sideStacker got a book note: %s", mustJSON(note))
// }

func (s *sideStacker) stack(m *Mantle) {
func (s *sideStacker) stack(m *Mantle, n *core.EpochNotification) {
book := m.book()
midGap := midGap(book)
worstBuys, worstSells := s.cancellableOrders(m)
worstBuys, worstSells := s.cancellableOrders(m, n.Epoch)
activeBuys, activeSells := len(worstBuys), len(worstSells)
cancelOrds := func(ords []*core.Order) {
for _, o := range ords {
Expand Down Expand Up @@ -279,13 +279,16 @@ func (s *sideStacker) stack(m *Mantle) {
}
}

func (s *sideStacker) cancellableOrders(m *Mantle) (
func (s *sideStacker) cancellableOrders(m *Mantle, currentEpoch uint64) (
worstBuys, worstSells []*core.Order) {

xcs := m.Exchanges()
xc := xcs[hostAddr]
mkt := xc.Markets[market]
for _, ord := range mkt.Orders {
if ord.Epoch >= currentEpoch-1 {
continue
}
if ord.Status == order.OrderStatusBooked && !ord.Cancelling {
if ord.Sell {
worstSells = append(worstSells, ord)
Expand Down
2 changes: 1 addition & 1 deletion server/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ func (auth *AuthManager) MissedPreimage(user account.AccountID, epochEnd time.Ti
}
}

// Penalize unbooks all of their orders, and notifies them of this action while
// suspend unbooks all of their orders, and notifies them of this action while
// citing the provided rule that corresponds to their most recent infraction.
// This method is to be used when a user's tier drops below 1.
// NOTE: There is now a 'tierchange' route for *any* tier change, but this
Expand Down

0 comments on commit 469155a

Please sign in to comment.