Skip to content

Commit

Permalink
fix(orderbook): persist trade before remove order
Browse files Browse the repository at this point in the history
  • Loading branch information
sangaman committed Dec 27, 2018
1 parent 5a539f5 commit 9ce892a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/orderbook/OrderBook.ts
Expand Up @@ -103,9 +103,9 @@ class OrderBook extends EventEmitter {
// we must remove the amount that was put on hold while the swap was pending for the remaining order
this.removeOrderHold(orderId, pairId, quantity);

await this.persistTrade(swapResult.quantity, this.getOwnOrder(swapResult.orderId, swapResult.pairId), undefined, swapResult.rHash);
this.removeOwnOrder(orderId, pairId, quantity, peerPubKey);
this.emit('ownOrder.swapped', { pairId, quantity, id: orderId });
await this.persistTrade(swapResult.quantity, this.getOwnOrder(swapResult.orderId, swapResult.pairId), undefined, swapResult.rHash);
}
});
this.swaps.on('swap.failed', (deal) => {
Expand Down

0 comments on commit 9ce892a

Please sign in to comment.