Skip to content

Commit

Permalink
add submit relay recovery tx interval delay
Browse files Browse the repository at this point in the history
  • Loading branch information
perfogic committed Oct 3, 2024
1 parent 356b42d commit 3d70591
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/orchestrator/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion packages/orchestrator/src/services/relayer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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}`);
Expand Down

0 comments on commit 3d70591

Please sign in to comment.