From d77b870fe4ee74a8ed0017eda7387e4e30f040d7 Mon Sep 17 00:00:00 2001 From: wphan Date: Sat, 2 Dec 2023 09:32:48 -0800 Subject: [PATCH] use specific connection for bulkaccountloader --- src/index.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index d4fba42e..f02507ca 100644 --- a/src/index.ts +++ b/src/index.ts @@ -198,12 +198,6 @@ const runBot = async () => { commitment: stateCommitment, }); - const sendTxConnection = new Connection(endpoint, { - wsEndpoint: wsEndpoint, - commitment: stateCommitment, - disableRetryOnRateLimit: true, - }); - let bulkAccountLoader: BulkAccountLoader | undefined; let lastBulkAccountLoaderSlot: number | undefined; let accountSubscription: DriftClientSubscriptionConfig = { @@ -215,8 +209,13 @@ const runBot = async () => { }; if (!config.global.websocket) { + const bulkAccountLoaderConnection = new Connection(endpoint, { + wsEndpoint: wsEndpoint, + commitment: stateCommitment, + disableRetryOnRateLimit: true, + }); bulkAccountLoader = new BulkAccountLoader( - connection, + bulkAccountLoaderConnection, stateCommitment, config.global.bulkAccountLoaderPollingInterval ); @@ -236,6 +235,11 @@ const runBot = async () => { skipPreflight: false, preflightCommitment: stateCommitment, }; + const sendTxConnection = new Connection(endpoint, { + wsEndpoint: wsEndpoint, + commitment: stateCommitment, + disableRetryOnRateLimit: true, + }); const txSender = new FastSingleTxSender({ connection: sendTxConnection, wallet,