Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
fix op_underfunded issue, fixes #69 (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsaraf authored Dec 2, 2018
1 parent 5b6224b commit d339e42
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/sellSideStrategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ func (s *sellSideStrategy) UpdateWithOps(offers []horizon.Offer) (ops []build.Tr
return nil, nil, fmt.Errorf("unable to update existing offers or create new offers: %s", e)
}
if op != nil {
if hitCapacityLimit && isModify {
reducedOrderSize := isModify && targetAmount.AsFloat() < utils.AmountStringAsFloat(offers[i].Amount)
hitCapacityLimitModify := isModify && hitCapacityLimit
if reducedOrderSize || hitCapacityLimitModify {
// prepend operations that reduce the size of an existing order because they decrease our liabilities
ops = append([]build.TransactionMutator{op}, ops...)
} else {
Expand Down

0 comments on commit d339e42

Please sign in to comment.