optimiz event catcher

This commit is contained in:
CounterFire2023 2024-01-12 17:12:50 +08:00
parent 981067421e
commit def646bc21

View File

@ -27,6 +27,7 @@ export class EventBatchSvr {
}
this.processer.set((cfg.address+cfg.topic).toLowerCase(), cfg)
}
this.eventCfgs.sort((a, b) => a.topic.localeCompare(b.topic))
this.redisKey = `event_${this.chainCfg.id}`
}
@ -54,10 +55,9 @@ export class EventBatchSvr {
uninParams.push(_param)
topicsSet = new Set()
} else {
let topic = getTopics(cfg)
if (!topicsSet.has(topic)) {
_param.params[0].topics.push(topic)
topicsSet.add(topic)
if (!topicsSet.has(cfg.topic)) {
_param.params[0].topics.push(cfg.topic)
topicsSet.add(cfg.topic)
}
_param.params[0].address.push(cfg.address)
}
@ -127,7 +127,7 @@ export class EventBatchSvr {
toBlock: 'latest',
address: [cfg.address]
}
params.topics = [getTopics(cfg)]
params.topics = [cfg.topic]
const result = {
jsonrpc: "2.0",
method: "eth_getLogs",