protocol-v2
protocol-v2 copied to clipboard
Duplicate transaction sent in FastSingleTxSender and RetryTxSender
FastSingleTxSender should send the transaction only once.
class FastSingleTxSender {
async sendRawTransaction(
rawTransaction: Buffer | Uint8Array,
opts: ConfirmOptions
): Promise<TxSigAndSlot> {
let txid: TransactionSignature;
try {
txid = await this.connection.sendRawTransaction(rawTransaction, opts);
this.sendToAdditionalConnections(rawTransaction, opts);
} catch (e) {
console.error(e);
throw e;
}
this.connection.sendRawTransaction(rawTransaction, opts).catch((e) => {
console.error(e);
});
this.sendToAdditionalConnections(rawTransaction, opts);
...
}
In RetryTxSender, there is no handling for This transaction has already been processed
error, so it happens every time
SendTransactionError: failed to send transaction: Transaction simulation failed: This transaction has already been processed
at Connection.sendEncodedTransaction (drift/js/node_modules/.pnpm/@[email protected]/node_modules/@solana/web3.js/src/connection.ts:5921:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Connection.sendRawTransaction (drift/js/node_modules/.pnpm/@[email protected]/node_modules/@solana/web3.js/src/connection.ts:5880:20) {
logs: []
}