From a5276b2fe97c7817c4b1b7864092aee9563be916 Mon Sep 17 00:00:00 2001 From: jayy04 <103467857+jayy04@users.noreply.github.com> Date: Thu, 28 Mar 2024 20:32:31 -0400 Subject: [PATCH] [CT-712] send updates for both normal order matches and liquidation (#1280) (#1281) --- protocol/x/clob/abci.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/protocol/x/clob/abci.go b/protocol/x/clob/abci.go index da97274adf..a22606f18a 100644 --- a/protocol/x/clob/abci.go +++ b/protocol/x/clob/abci.go @@ -174,10 +174,18 @@ func PrepareCheckState( // Send an update for reverted local operations. for _, operation := range localValidatorOperationsQueue { if match := operation.GetMatch(); match != nil { - orderIdsToSend[match.GetMatchOrders().TakerOrderId] = true - - for _, fill := range match.GetMatchOrders().Fills { - orderIdsToSend[fill.MakerOrderId] = true + // For normal order matches, we send an update for the taker and maker orders. + if matchedOrders := match.GetMatchOrders(); matchedOrders != nil { + orderIdsToSend[matchedOrders.TakerOrderId] = true + for _, fill := range matchedOrders.Fills { + orderIdsToSend[fill.MakerOrderId] = true + } + } + // For liquidation matches, we send an update for the maker orders. + if matchedLiquidation := match.GetMatchPerpetualLiquidation(); matchedLiquidation != nil { + for _, fill := range matchedLiquidation.Fills { + orderIdsToSend[fill.MakerOrderId] = true + } } } }