Skip to content

Commit

Permalink
[CT-712] send fill amount updates for reverted operations (#1240)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayy04 authored Mar 26, 2024
1 parent 9dd90ff commit da39a93
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions protocol/x/clob/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,26 @@ func PrepareCheckState(
// For orders that are filled in the last block, send an orderbook update to the grpc streams.
if keeper.GetGrpcStreamingManager().Enabled() {
allUpdates := types.NewOffchainUpdates()
orderIdsToSend := make(map[types.OrderId]bool)

// 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
}
}
}

// Send an update for orders that were proposed.
for _, orderId := range processProposerMatchesEvents.OrderIdsFilledInLastBlock {
orderIdsToSend[orderId] = true
}

// Send update.
for orderId := range orderIdsToSend {
if _, exists := keeper.MemClob.GetOrder(ctx, orderId); exists {
orderbookUpdate := keeper.MemClob.GetOrderbookUpdatesForOrderUpdate(ctx, orderId)
allUpdates.Append(orderbookUpdate)
Expand Down

0 comments on commit da39a93

Please sign in to comment.