allow setting sync interval for blocks
Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
parent
6130c46d90
commit
02f79a0de0
@ -1,3 +1,4 @@
|
|||||||
|
export const blockSyncInterval = 10000
|
||||||
export const enabledChains = ['1', '10', '56', '100', '137', '42161']
|
export const enabledChains = ['1', '10', '56', '100', '137', '42161']
|
||||||
export const chainsWithEncryptedNotes = ['1', '5', '56', '100', '137']
|
export const chainsWithEncryptedNotes = ['1', '5', '56', '100', '137']
|
||||||
export default {
|
export default {
|
||||||
|
@ -2,7 +2,7 @@ import fs from 'fs'
|
|||||||
import zlib from 'zlib'
|
import zlib from 'zlib'
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
|
|
||||||
import networkConfig from '../../networkConfig'
|
import networkConfig, { blockSyncInterval } from '../../networkConfig'
|
||||||
|
|
||||||
export function download({ name, directory }) {
|
export function download({ name, directory }) {
|
||||||
const path = `${directory}${name}.gz`.toLowerCase()
|
const path = `${directory}${name}.gz`.toLowerCase()
|
||||||
@ -53,7 +53,7 @@ export async function getPastEvents({ type, fromBlock, netId, events, contractAt
|
|||||||
const blockDifference = Math.ceil(blockNumberBuffer - fromBlock)
|
const blockDifference = Math.ceil(blockNumberBuffer - fromBlock)
|
||||||
|
|
||||||
// eth_logs and eth_filter are restricted > 10,000 block queries
|
// eth_logs and eth_filter are restricted > 10,000 block queries
|
||||||
const blockRange = 10000
|
const blockRange = blockSyncInterval ? blockSyncInterval : 10_000
|
||||||
|
|
||||||
let chunksCount = blockDifference === 0 ? 1 : Math.ceil(blockDifference / blockRange)
|
let chunksCount = blockDifference === 0 ? 1 : Math.ceil(blockDifference / blockRange)
|
||||||
const chunkSize = Math.ceil(blockDifference / chunksCount)
|
const chunkSize = Math.ceil(blockDifference / chunksCount)
|
||||||
|
Loading…
Reference in New Issue
Block a user