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.
This commit is contained in:
Jon Cinque 2020-11-11 13:12:09 +01:00 committed by GitHub
parent ab70c15709
commit 58354d166b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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.`,
);
}