fix: fallback to connection commitment when confirming transactions (#13285)
* fix: fallback to connection commitment when confirming transactions * chore: bump * chore: fix tests
This commit is contained in:
parent
636ae12621
commit
7b3f96ab30
|
@ -2163,8 +2163,6 @@ export class Connection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm the transaction identified by the specified signature.
|
* Confirm the transaction identified by the specified signature.
|
||||||
*
|
|
||||||
* If `commitment` is not specified, default to 'max'.
|
|
||||||
*/
|
*/
|
||||||
async confirmTransaction(
|
async confirmTransaction(
|
||||||
signature: TransactionSignature,
|
signature: TransactionSignature,
|
||||||
|
@ -2180,7 +2178,7 @@ export class Connection {
|
||||||
assert(decodedSignature.length === 64, 'signature has invalid length');
|
assert(decodedSignature.length === 64, 'signature has invalid length');
|
||||||
|
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
const subscriptionCommitment: Commitment = commitment || 'max';
|
const subscriptionCommitment = commitment || this.commitment;
|
||||||
|
|
||||||
let subscriptionId;
|
let subscriptionId;
|
||||||
let response: RpcResponseAndContext<SignatureResult> | null = null;
|
let response: RpcResponseAndContext<SignatureResult> | null = null;
|
||||||
|
|
|
@ -129,6 +129,7 @@ describe('load BPF Rust program', () => {
|
||||||
transaction,
|
transaction,
|
||||||
[payerAccount],
|
[payerAccount],
|
||||||
{
|
{
|
||||||
|
commitment: 'max',
|
||||||
skipPreflight: true,
|
skipPreflight: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -1351,7 +1351,7 @@ describe('token methods', () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const connection = new Connection(url);
|
const connection = new Connection(url, 'recent');
|
||||||
const newAccount = new Account().publicKey;
|
const newAccount = new Account().publicKey;
|
||||||
|
|
||||||
let testToken: Token;
|
let testToken: Token;
|
||||||
|
@ -1364,7 +1364,6 @@ describe('token methods', () => {
|
||||||
const payerAccount = new Account();
|
const payerAccount = new Account();
|
||||||
await connection.confirmTransaction(
|
await connection.confirmTransaction(
|
||||||
await connection.requestAirdrop(payerAccount.publicKey, 100000000000),
|
await connection.requestAirdrop(payerAccount.publicKey, 100000000000),
|
||||||
'single',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const mintOwner = new Account();
|
const mintOwner = new Account();
|
||||||
|
@ -1402,7 +1401,7 @@ describe('token methods', () => {
|
||||||
new u64(1),
|
new u64(1),
|
||||||
);
|
);
|
||||||
|
|
||||||
await connection.confirmTransaction(testSignature);
|
await connection.confirmTransaction(testSignature, 'max');
|
||||||
|
|
||||||
testOwner = accountOwner;
|
testOwner = accountOwner;
|
||||||
testToken = token;
|
testToken = token;
|
||||||
|
|
Loading…
Reference in New Issue