From b5f89a93d8d89c4ef2031682883b6ba54a9419a2 Mon Sep 17 00:00:00 2001 From: ze97286 Date: Fri, 13 Oct 2023 11:57:46 +0100 Subject: [PATCH] fix: ensure invalid market for transfer doesn't panic --- CHANGELOG.md | 1 + core/execution/common/market_activity_tracker.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9ecc5cb92..707b81030a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -464,6 +464,7 @@ - [8702](https://github.com/vegaprotocol/vega/issues/8702) - Fix panic on auction exit after stop orders expired in auction - [8703](https://github.com/vegaprotocol/vega/issues/8703) - Wire stop orders cancellation - [8698](https://github.com/vegaprotocol/vega/issues/8698) - Always set the `ToAccount` field when clearing fees. +- [9773](https://github.com/vegaprotocol/vega/issues/9773) - Ensure invalid market for transfer doesn't panic ## 0.71.0 diff --git a/core/execution/common/market_activity_tracker.go b/core/execution/common/market_activity_tracker.go index c730c9b2c6..a1413fa119 100644 --- a/core/execution/common/market_activity_tracker.go +++ b/core/execution/common/market_activity_tracker.go @@ -711,6 +711,9 @@ func (mat *MarketActivityTracker) calculateMetricForParty(asset, party string, m // for each market in scope, for each epoch in the time window get the metric entry, sum up for each epoch in the time window and divide by window size (or calculate variance - for volatility) for _, market := range markets { marketTracker := assetTrackers[market] + if marketTracker == nil { + continue + } switch metric { case vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_POSITION: uTotal += marketTracker.getPositionMetricTotal(party, windowSize)