Skip to content

Commit

Permalink
Ignore cancel events for swaps that are in progress
Browse files Browse the repository at this point in the history
workaround for jl777/SuperNET#956
  • Loading branch information
lukechilds committed Aug 22, 2018
1 parent a176aba commit 6d5d9d4
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions app/renderer/swap-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,20 @@ class SwapDB {
}

if (message.method === 'failed') {
swap.status = 'failed';
swap.progress = 1;

// TODO: Add error messages once we have errors documented
// https://github.com/atomiclabs/hyperdex/issues/180
swap.error = {
code: message.error,
message: `Error Code: ${message.error}`,
};
// This check is to ignore cancel events when the trade is no longer pending
// It's most likely caused by this mm bug
// https://github.com/jl777/SuperNET/issues/956
if (!(swap.status !== 'pending' && [-9998, -9997].includes(message.error))) {
swap.status = 'failed';
swap.progress = 1;

// TODO: Add error messages once we have errors documented
// https://github.com/atomiclabs/hyperdex/issues/180
swap.error = {
code: message.error,
message: `Error Code: ${message.error}`,
};
}
}
});

Expand Down

0 comments on commit 6d5d9d4

Please sign in to comment.