From 1169c66100967d6da322d50432311b8a714460c9 Mon Sep 17 00:00:00 2001 From: Mike van Rossum Date: Mon, 13 Aug 2018 16:41:39 +0800 Subject: [PATCH] [GB] recheck the order after cancel failr, fix #2440 --- exchange/wrappers/coinfalcon.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/exchange/wrappers/coinfalcon.js b/exchange/wrappers/coinfalcon.js index 92f82594a..ed498cdb5 100644 --- a/exchange/wrappers/coinfalcon.js +++ b/exchange/wrappers/coinfalcon.js @@ -244,7 +244,22 @@ Trader.prototype.cancelOrder = function(order, callback) { const handle = this.processResponse(this.cancelOrder, args, (err, res) => { if(err) { if(err.message.includes('has wrong status.')) { - return callback(undefined, true); + + // see https://github.com/askmike/gekko/issues/2440 + console.log('CANCELFIX', order, 'order has wrong status...'); + return this.checkOrder(order, (err, res) => { + console.log('CANCELFIX', order, 'checked it:', res); + + if(err) { + return callback(err); + } + + if(!res.open) { + return callback(undefined, true); + } + + return this.cancelOrder(order, callback); + }); } return callback(err); }