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();
|
coupling.price.storeHistory.stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var lastSyncBlockHeight = 0;
|
||||||
|
|
||||||
function blockchainReCheck() {
|
function blockchainReCheck() {
|
||||||
if (blockchainReCheck.timeout !== undefined) {
|
if (blockchainReCheck.timeout !== undefined) {
|
||||||
clearTimeout(blockchainReCheck.timeout);
|
clearTimeout(blockchainReCheck.timeout);
|
||||||
@ -697,6 +699,9 @@ function blockchainReCheck() {
|
|||||||
if (!global.sinkID)
|
if (!global.sinkID)
|
||||||
return blockchainReCheck.timeout = setTimeout(blockchainReCheck, WAIT_TIME);
|
return blockchainReCheck.timeout = setTimeout(blockchainReCheck, WAIT_TIME);
|
||||||
|
|
||||||
|
floBlockchainAPI.promisedAPI('api/blocks?limit=1').then(result => {
|
||||||
|
if (lastSyncBlockHeight < result.blocks[0].height) {
|
||||||
|
lastSyncBlockHeight = result.blocks[0].height;
|
||||||
confirmDepositFLO();
|
confirmDepositFLO();
|
||||||
confirmDepositToken();
|
confirmDepositToken();
|
||||||
retryWithdrawalFLO();
|
retryWithdrawalFLO();
|
||||||
@ -704,6 +709,8 @@ function blockchainReCheck() {
|
|||||||
confirmWithdrawalFLO();
|
confirmWithdrawalFLO();
|
||||||
confirmWithdrawalToken();
|
confirmWithdrawalToken();
|
||||||
}
|
}
|
||||||
|
}).catch(error => console.error(error));
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
login,
|
login,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user