From b14e0360a171f6aff3e9eb10fe5ed0141306d262 Mon Sep 17 00:00:00 2001 From: lil perp Date: Tue, 9 Jan 2024 11:29:27 -0500 Subject: [PATCH] sdk: tweak polling tx confirmation (#812) * sdk: fix tests not building * sdk: tweak polling tx confirmation --- sdk/src/tx/baseTxSender.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/src/tx/baseTxSender.ts b/sdk/src/tx/baseTxSender.ts index 42d9ad2b9..e1f5f905d 100644 --- a/sdk/src/tx/baseTxSender.ts +++ b/sdk/src/tx/baseTxSender.ts @@ -247,9 +247,11 @@ export abstract class BaseTxSender implements TxSender { commitment: Commitment = 'finalized' ): Promise | undefined> { let totalTime = 0; - let backoffTime = 250; + let backoffTime = 400; // approx block time while (totalTime < this.timeout) { + await new Promise((resolve) => setTimeout(resolve, backoffTime)); + const response = await this.connection.getSignatureStatus(signature); const result = response && response.value?.[0]; @@ -257,7 +259,6 @@ export abstract class BaseTxSender implements TxSender { return { context: result.context, value: { err: null } }; } - await new Promise((resolve) => setTimeout(resolve, backoffTime)); totalTime += backoffTime; backoffTime = Math.min(backoffTime * 2, 5000); }