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
sindresorhus committed Aug 27, 2018
1 parent 007f56e commit eb21456
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 @@ -219,15 +219,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 eb21456

Please sign in to comment.