From 469155a8c0a57b6b051bf1afb18ae705a4152b35 Mon Sep 17 00:00:00 2001 From: Brian Stafford Date: Fri, 28 Jul 2023 07:13:03 -0500 Subject: [PATCH] cp --- dex/testing/loadbot/sidestacker.go | 11 +++++++---- server/auth/auth.go | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dex/testing/loadbot/sidestacker.go b/dex/testing/loadbot/sidestacker.go index 5c2ceba148..d7910e72fc 100644 --- a/dex/testing/loadbot/sidestacker.go +++ b/dex/testing/loadbot/sidestacker.go @@ -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() @@ -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 { @@ -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) diff --git a/server/auth/auth.go b/server/auth/auth.go index 7dede4336f..10f31c2c7f 100644 --- a/server/auth/auth.go +++ b/server/auth/auth.go @@ -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