Skip to content

Commit

Permalink
fix MM bot panic (see decred#3130 for details)
Browse files Browse the repository at this point in the history
  • Loading branch information
norwnd committed Dec 24, 2024
1 parent 932b819 commit 7278546
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -5766,23 +5766,23 @@ type MultiTradeResult struct {
// MultiTrade is used to place multiple standing limit orders on the same
// side of the same market simultaneously.
func (c *Core) MultiTrade(pw []byte, form *MultiTradeForm) []*MultiTradeResult {
results := make([]*MultiTradeResult, len(form.Placements))
results := make([]*MultiTradeResult, 0, len(form.Placements))
reqs, err := c.prepareMultiTradeRequests(pw, form)
if err != nil {
for i := range results {
results[i] = &MultiTradeResult{Error: err}
for range form.Placements {
results = append(results, &MultiTradeResult{Error: err})
}
return results
}

for i, req := range reqs {
for _, req := range reqs {
var corder *Order
corder, err = c.sendTradeRequest(req)
if err != nil {
results[i] = &MultiTradeResult{Error: err}
results = append(results, &MultiTradeResult{Error: err})
continue
}
results[i] = &MultiTradeResult{Order: corder}
results = append(results, &MultiTradeResult{Order: corder})
}

return results
Expand Down

0 comments on commit 7278546

Please sign in to comment.