This commit is contained in:
Gerardo Nardelli 2019-11-28 16:56:18 -03:00
parent c19f48ef3f
commit ed2de112a2
2 changed files with 12 additions and 4 deletions

@ -1,7 +1,15 @@
const baseConfig = require('./base.config')
const { EXIT_CODES } = require('../src/utils/constants')
const id = `${baseConfig.id}-swap-tokens`
const workerRequired = baseConfig.id === 'erc-native'
if (!workerRequired) {
console.error(`Swap tokens worker not required for bridge mode ${process.env.ORACLE_BRIDGE_MODE}`)
process.exit(EXIT_CODES.WATCHER_NOT_REQUIRED)
}
module.exports = {
...baseConfig.bridgeConfig,
...baseConfig.foreignConfig,

@ -148,14 +148,14 @@ async function main({ sendToQueue, sendToWorker }) {
logger.info(`Found ${events.length} ${config.event} events`)
if (events.length) {
const job = await processEvents(events, toBlock)
logger.info('Transactions to send:', job.length)
if (job.length) {
if (sendToWorker) {
await sendToWorker({ blockNumber: toBlock.toString() })
}
const job = await processEvents(events, toBlock)
logger.info('Transactions to send:', job.length)
if (job.length) {
await sendToQueue(job)
}
}