From 7645c5b251a235f06f0674d6df392744886f3e39 Mon Sep 17 00:00:00 2001 From: Chris Heaney Date: Mon, 8 Jan 2024 16:46:42 -0500 Subject: [PATCH] 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); }