games_app/backend/dist-test-faq/utils/bscDepositScan.js

20 lines
886 B
JavaScript

"use strict";
/**
* Pure helpers for BSC deposit scanner block windows.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.computeBscScanFromBlock = computeBscScanFromBlock;
exports.computeBscCommittedScannerBlock = computeBscCommittedScannerBlock;
function computeBscScanFromBlock(opts) {
const { lastBlock, currentBlock, initialLookback, overlapLookback } = opts;
if (lastBlock == null || lastBlock < 0) {
return Math.max(0, currentBlock - Math.max(0, initialLookback));
}
const next = lastBlock + 1;
return Math.max(0, next - Math.max(0, overlapLookback));
}
/** Persist scanner tip behind head by confirmations so late logs can still be seen. */
function computeBscCommittedScannerBlock(currentBlock, confirmations) {
return Math.max(0, currentBlock - Math.max(0, confirmations));
}
//# sourceMappingURL=bscDepositScan.js.map