vegaprotocol / data-node

A rich API server for Vega Protocol
https://vega.xyz
Other
3 stars 1 forks source link

fix: market depth incorrect #719

Closed ettec closed 2 years ago

ettec commented 2 years ago

closes #705 In the datanode V1 market depth code we have this check -> https://github.com/vegaprotocol/data-node/blob/8c3a1e9845537c6d32dbdc01de4811cb30ee2fb4/subscribers/market_depth.go#L282 which relies on the vega time (block time) being correctly set, however as the V1 broker is multithreaded per event type there is no guarantee that the time event that sets the vega time will arrive at the market depth subscriber with the orders to which the time corresponds, so for example orders from block 1 and 2 could be processed with the time from block 2, resulting in orders from block 2 being thrown away due to the check above (v2 event broker is single threaded which is why it works in v2) . This change fixes that by sending the vega time of the block along with the order event in the v1 broker to ensure that a correct sequence number is generated for each order event.