Commit d0747de
committed
Skip done trades in error() to prevent late-error mutation
Mainly a pre-defensive update here since it _looks like it could happen_
but I've never seen any proof "delayed replay updates" happen live. More
of a logical protection fix against other condtions until we get a
better refactor of some of the long state-tracking-logic in place.
`Wrapper.error` looks up `self.trades[(clientId, reqId)]` whenever the
incoming reqId is non-negative, but `self.trades` never evicts
finished orders. A late or replayed error for a long-completed order
would silently:
- flip its `OrderStatus.status` to `ValidationError` on the warning
branch (corrupting the audit log of a Filled/Cancelled order); or
- set `advancedError` on the trade in the error branch
(`if not isDone()` only guards the cancel-mutation, not the
`advancedError` assignment).
Treat done trades as absent at the lookup site so the rest of `error`
only acts on live orders. Live-order behavior is unchanged.1 parent c679af6 commit d0747de
2 files changed
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1678 | 1678 | | |
1679 | 1679 | | |
1680 | 1680 | | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
1681 | 1689 | | |
1682 | 1690 | | |
1683 | 1691 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments