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:
parent
ab70c15709
commit
58354d166b
|
@ -2206,7 +2206,7 @@ export class Connection {
|
||||||
case 'recent':
|
case 'recent':
|
||||||
case 'single':
|
case 'single':
|
||||||
case 'singleGossip': {
|
case 'singleGossip': {
|
||||||
timeoutMs = 10 * 1000;
|
timeoutMs = 30 * 1000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// exhaust enums to ensure full coverage
|
// exhaust enums to ensure full coverage
|
||||||
|
@ -2225,7 +2225,9 @@ export class Connection {
|
||||||
if (response === null) {
|
if (response === null) {
|
||||||
const duration = (Date.now() - start) / 1000;
|
const duration = (Date.now() - start) / 1000;
|
||||||
throw new Error(
|
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.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue