fix some bug
This commit is contained in:
parent
ad8229370b
commit
15f0b970c8
@ -1,4 +1,5 @@
|
|||||||
import { HttpRetryProvider } from 'chain/HttpRetryProvider'
|
import { HttpRetryProvider } from 'chain/HttpRetryProvider'
|
||||||
|
import logger from 'logger/logger'
|
||||||
import { NftTransferEvent } from 'models/NftTransferEvent'
|
import { NftTransferEvent } from 'models/NftTransferEvent'
|
||||||
import { RedisClient } from 'redis/RedisClient'
|
import { RedisClient } from 'redis/RedisClient'
|
||||||
|
|
||||||
@ -47,7 +48,10 @@ export class EventSyncSvr {
|
|||||||
this.fromBlock = Math.max(parseInt(blockStr), this.fromBlock)
|
this.fromBlock = Math.max(parseInt(blockStr), this.fromBlock)
|
||||||
}
|
}
|
||||||
this.toBlock = currentBlock
|
this.toBlock = currentBlock
|
||||||
console.log(`query events:: ${this.event} address: ${this.address} from: ${this.fromBlock} to: ${this.toBlock}`)
|
if (this.fromBlock > this.toBlock) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.log(`query events:: ${this.event} address: ${this.address} from: ${this.fromBlock} to: ${this.toBlock}`)
|
||||||
let events = getPastEventsIter({
|
let events = getPastEventsIter({
|
||||||
contract: this.contract,
|
contract: this.contract,
|
||||||
event: this.event,
|
event: this.event,
|
||||||
|
@ -195,6 +195,7 @@ export function* getPastEventsIter({
|
|||||||
yield new RedisClient().set(redisKey, from + '')
|
yield new RedisClient().set(redisKey, from + '')
|
||||||
}
|
}
|
||||||
yield getPastEvents({ contract, event, fromBlock: from, toBlock: toBlockBN, options })
|
yield getPastEvents({ contract, event, fromBlock: from, toBlock: toBlockBN, options })
|
||||||
|
yield new RedisClient().set(redisKey, toBlockBN.add(ONE) + '')
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function processEvents(web3, iterator, processedEvent) {
|
export async function processEvents(web3, iterator, processedEvent) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user