Skip to content

Commit

Permalink
update check
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTrunk committed Nov 24, 2024
1 parent e0d024c commit 0f87ac7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/services/application/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,24 +616,24 @@ async function checkBlockBook(ip, port, appsname) {
const response1 = await serviceHelper.httpGetRequest(`http://${ip}:${port}/api`, 5000);
const response2 = await serviceHelper.httpGetRequest(`http://${ip}:${port}/api/v2/address/${addressList[index]}?pageSize=50`, 5000);
const currentTime = new Date().getTime();
if (response2.data.txids.length > 0 && response1.data.blockbook.bestHeight > (response1.data.backend.blocks - 100) && response1.data.blockbook.bestHeight > heightList[index] && response1.data.backend.blocks > heightList[index] && !response1.data.inSync) {
if (response2.data.txids.length > 0 && response1.data.blockbook.bestHeight > (response1.data.backend.blocks - 100) && response1.data.blockbook.bestHeight > heightList[index] && response1.data.backend.blocks > heightList[index]) {
const lastBlockTmstp = new Date(response1.data.blockbook.lastBlockTime).getTime();
const timeDifference = currentTime - lastBlockTmstp;
if (response2.data.txs <= 50 && response2.data.txids.length === response2.data.txs) {
if (response2.data.txids.length === response2.data.txs) {
if (timeDifference < 1000 * 60 * 60 * 6) { // 6 hours
if (timeDifference < 1000 * 60 * 60 * 3) { // 3 hours
return true;
}
}
} else if (response2.data.txs > 50 && response2.data.totalPages > response2.data.page) {
if (response2.data.txids.length >= 50) {
if (timeDifference < 1000 * 60 * 60 * 6) { // 6 hours
if (timeDifference < 1000 * 60 * 60 * 3) { // 3 hours
return true;
}
}
} else if (response2.data.txs > 50 && response2.data.totalPages === response2.data.page) {
if (response2.data.txids.length === response2.data.txs % 50) {
if (timeDifference < 1000 * 60 * 60 * 6) { // 6 hours
if (timeDifference < 1000 * 60 * 60 * 3) { // 3 hours
return true;
}
}
Expand Down

0 comments on commit 0f87ac7

Please sign in to comment.