diff --git a/packages/orchestrator/src/constants.ts b/packages/orchestrator/src/constants.ts index 88d4a5c..141beaa 100644 --- a/packages/orchestrator/src/constants.ts +++ b/packages/orchestrator/src/constants.ts @@ -2,6 +2,7 @@ export const RELAY_HEADER_BATCH_SIZE = 250; export const SCAN_MEMPOOL_CHUNK_SIZE = 1000; export const SCAN_MEMPOOL_CHUNK_INTERVAL_DELAY = 100; export const SCAN_BLOCK_TXS_INTERVAL_DELAY = 100; +export const SUBMIT_RELAY_RECOVERY_TX_INTERVAL_DELAY = 100; export const SUBMIT_RELAY_CHECKPOINT_INTERVAL_DELAY = 100; export const RELAY_DEPOSIT_BLOCKS_SIZE = 200; // 10 blocks export const RETRY_DELAY = 1000; // 1 second diff --git a/packages/orchestrator/src/services/relayer/index.ts b/packages/orchestrator/src/services/relayer/index.ts index 80c96ba..7d7b278 100644 --- a/packages/orchestrator/src/services/relayer/index.ts +++ b/packages/orchestrator/src/services/relayer/index.ts @@ -41,6 +41,7 @@ import { SCAN_MEMPOOL_CHUNK_INTERVAL_DELAY, SCAN_MEMPOOL_CHUNK_SIZE, SUBMIT_RELAY_CHECKPOINT_INTERVAL_DELAY, + SUBMIT_RELAY_RECOVERY_TX_INTERVAL_DELAY, } from "../../constants"; import { chunkArray } from "../../utils/array"; import { @@ -553,12 +554,12 @@ class RelayerService implements RelayerInterface { const txs = await this.appBitcoinClient.signedRecoveryTxs(); for (const recoveryTx of txs) { if (relayed[recoveryTx]) continue; - const tx = await this.btcClient.sendrawtransaction({ hexstring: Buffer.from(recoveryTx, "base64").toString("hex"), }); relayed[recoveryTx] = true; console.log(`Relayed recovery tx ${tx}`); + await setTimeout(SUBMIT_RELAY_RECOVERY_TX_INTERVAL_DELAY); } } catch (err) { this.logger.error(`[RELAY_RECOVERY_DEPOSIT] ${err?.message}`);