can't bring bnbchaind back when delist and have the order in previous snapshort
unclezoro opened this issue · comments
in LoadOrderBookSnapshot
function, allpairs
comes from:
allPairs := kp.PairMapper.ListAllTradingPairs(ctx)
we get the latest trading pair which do not contains the delisted trading pair,
but in the following logical, the trading pair may exist in ao.Orders
, and will cause panic
for _, m := range ao.Orders {
orderHolder := m
if kp.allOrders[m.Symbol] ==nil{
fmt.Println(m.Symbol)
}
kp.allOrders[m.Symbol][m.Id] = &orderHolder
if m.CreatedHeight == height {
kp.roundOrders[m.Symbol] = append(kp.roundOrders[m.Symbol], m.Id)
if m.TimeInForce == TimeInForce.IOC {
kp.roundIOCOrders[m.Symbol] = append(kp.roundIOCOrders[m.Symbol], m.Id)
}
}
if kp.CollectOrderInfoForPublish {
if _, exists := kp.OrderInfosForPub[m.Id]; !exists {
bnclog.Debug("add order to order changes map, during load snapshot, from active orders", "orderId", m.Id)
kp.OrderInfosForPub[m.Id] = &orderHolder
}
}
}
Because delist happens in breath block, I think this is not an issue anymore, @yutianwu please have a double check, then we can close this issue.
We delist trading pair first and then we snapshot order book, so it would be fine