Skip to content

Commit

Permalink
Merge pull request #3361 from vegaprotocol/bugfix/3350-fix-equite-lik…
Browse files Browse the repository at this point in the history
…e-share-in-market-data

force reloading equity share when party lp is cancelled or goes out of pending state
  • Loading branch information
jeremyletang committed Apr 16, 2021
2 parents 7b4971f + 967dd71 commit 333d7a2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion execution/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -3633,8 +3633,11 @@ func (m *Market) updateAndCreateOrders(
return parties[i].Party < parties[j].Party
})

var updateShares bool
for _, v := range parties {
if !v.Faulty {
// update shares to add this party to the shares
updateShares = true
m.liquidity.RemovePending(v.Party)
continue
}
Expand All @@ -3649,8 +3652,21 @@ func (m *Market) updateAndCreateOrders(
}

// now the party had not enough enough funds to pay the margin
_ = m.cancelDistressedLiquidityProvision(
err := m.cancelDistressedLiquidityProvision(
ctx, v.Party, faultyLPOrders[v.Party])
if err != nil {
m.log.Debug("issue cancelling liquidity provision",
logging.Error(err),
logging.MarketID(m.GetID()),
logging.PartyID(v.Party))
}
// update shares to remove this party from the shares
updateShares = true
}

if updateShares {
// force update of shares so they are updated for all
_ = m.equityShares.Shares(m.liquidity.GetInactiveParties())
}

return nil
Expand Down

0 comments on commit 333d7a2

Please sign in to comment.