Optimised blockchainReCheck
- Check if a new block has come at start of blockchainReCheck - Checks for confirmation of txns only when a new block in the blockchain
This commit is contained in:
parent
d444e96259
commit
09953d252a
@ -689,6 +689,8 @@ periodicProcess.stop = function() {
|
||||
coupling.price.storeHistory.stop();
|
||||
};
|
||||
|
||||
var lastSyncBlockHeight = 0;
|
||||
|
||||
function blockchainReCheck() {
|
||||
if (blockchainReCheck.timeout !== undefined) {
|
||||
clearTimeout(blockchainReCheck.timeout);
|
||||
@ -697,12 +699,17 @@ function blockchainReCheck() {
|
||||
if (!global.sinkID)
|
||||
return blockchainReCheck.timeout = setTimeout(blockchainReCheck, WAIT_TIME);
|
||||
|
||||
confirmDepositFLO();
|
||||
confirmDepositToken();
|
||||
retryWithdrawalFLO();
|
||||
retryWithdrawalToken();
|
||||
confirmWithdrawalFLO();
|
||||
confirmWithdrawalToken();
|
||||
floBlockchainAPI.promisedAPI('api/blocks?limit=1').then(result => {
|
||||
if (lastSyncBlockHeight < result.blocks[0].height) {
|
||||
lastSyncBlockHeight = result.blocks[0].height;
|
||||
confirmDepositFLO();
|
||||
confirmDepositToken();
|
||||
retryWithdrawalFLO();
|
||||
retryWithdrawalToken();
|
||||
confirmWithdrawalFLO();
|
||||
confirmWithdrawalToken();
|
||||
}
|
||||
}).catch(error => console.error(error));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user