fix(plugins) fix setTimeout args
This commit is contained in:
parent
8009cd04ac
commit
ca8f9420af
1 changed files with 7 additions and 6 deletions
|
|
@ -270,7 +270,7 @@ function executeTx(deviceFingerprint, txId, triggeredByUser, cb) {
|
||||||
// indicate ACK to machine
|
// indicate ACK to machine
|
||||||
cb(null, {
|
cb(null, {
|
||||||
statusCode: 201, // Created
|
statusCode: 201, // Created
|
||||||
txId: txId
|
txId: txHash
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -365,26 +365,27 @@ function _monitorTx(deviceFingerprint, tx) {
|
||||||
infoPlugin.getTx(tx.txHash, tx.toAddress, function(err, txInfo) {
|
infoPlugin.getTx(tx.txHash, tx.toAddress, function(err, txInfo) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
return setTimeout(_monitorTx, 300, [deviceFingerprint, tx]);
|
return setTimeout(_monitorTx, 300, deviceFingerprint, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_checkTx(deviceFingerprint, tx, txInfo))
|
if (_checkTx(deviceFingerprint, tx, txInfo))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setTimeout(_monitorTx, 300, [deviceFingerprint, tx]);
|
setTimeout(_monitorTx, 300, deviceFingerprint, tx);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function _monitorAddress(deviceFingerprint, tx) {
|
function _monitorAddress(deviceFingerprint, tx) {
|
||||||
|
if (!tx) throw new Error('No tx');
|
||||||
infoPlugin.getAddressLastTx(tx.toAddress, function(err, txInfo) {
|
infoPlugin.getAddressLastTx(tx.toAddress, function(err, txInfo) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
return setTimeout(_monitorAddress, 300, [deviceFingerprint, tx]);
|
return setTimeout(_monitorAddress, 300, deviceFingerprint, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no tx occured at all or deposit address was reused; some previous tx was returned
|
// no tx occured at all or deposit address was reused; some previous tx was returned
|
||||||
if (!txInfo || txInfo.tsReceived < tx.created) {
|
if (!txInfo || txInfo.tsReceived < tx.created) {
|
||||||
return setTimeout(_monitorAddress, 300, [deviceFingerprint, tx]);
|
return setTimeout(_monitorAddress, 300, deviceFingerprint, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// when sent TX is not enough
|
// when sent TX is not enough
|
||||||
|
|
@ -406,7 +407,7 @@ function _monitorAddress(deviceFingerprint, tx) {
|
||||||
_setDispenseStatus(deviceFingerprint, tx, 'fullDeposit', txInfo.amount);
|
_setDispenseStatus(deviceFingerprint, tx, 'fullDeposit', txInfo.amount);
|
||||||
|
|
||||||
// start monitoring TX (instead of an address)
|
// start monitoring TX (instead of an address)
|
||||||
setTimeout(_monitorTx, 300, [deviceFingerprint, tx]);
|
setTimeout(_monitorTx, 300, deviceFingerprint, tx);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue