From 58354d166b4e07128dfccd29880859346ce36f60 Mon Sep 17 00:00:00 2001 From: Jon Cinque Date: Wed, 11 Nov 2020 13:12:09 +0100 Subject: [PATCH] feat: increase timeout in `confirmTransaction` (#13478) Developers have reported needing to change the timeout to suit their use cases, or not completely understanding what the timeout meant for their transaction, since it could timeout and still get processed. This increases the default timeout to `confirmTransaction` and adds more information to the error message. --- web3.js/src/connection.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 5aaee9c60..47d9f024d 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -2206,7 +2206,7 @@ export class Connection { case 'recent': case 'single': case 'singleGossip': { - timeoutMs = 10 * 1000; + timeoutMs = 30 * 1000; break; } // exhaust enums to ensure full coverage @@ -2225,7 +2225,9 @@ export class Connection { if (response === null) { const duration = (Date.now() - start) / 1000; throw new Error( - `Transaction was not confirmed in ${duration.toFixed(2)} seconds`, + `Transaction was not confirmed in ${duration.toFixed( + 2, + )} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`, ); }